Пример #1
0
 protected function Form_PreRender()
 {
     // If an existing InventoryModel is being edited, render the Quantities by Location and Transaction history datagrids
     if ($this->ctlInventoryEdit->blnEditMode) {
         // Render the Quantities by Location datagrid
         $objExpansionMap[InventoryLocation::ExpandLocation] = true;
         $this->ctlInventoryEdit->dtgInventoryQuantities->TotalItemCount = InventoryLocation::CountByInventoryModelIdLocations($this->ctlInventoryEdit->objInventoryModel->InventoryModelId);
         // If there are no rows in the datagrid, do not show the header column
         if ($this->ctlInventoryEdit->dtgInventoryQuantities->TotalItemCount == 0) {
             $this->ctlInventoryEdit->dtgInventoryQuantities->ShowHeader = false;
         } else {
             $this->ctlInventoryEdit->dtgInventoryQuantities->ShowHeader = true;
             // $this->ctlInventoryEdit->dtgInventoryQuantities->DataSource = InventoryLocation::LoadArrayByInventoryModelId($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, $this->ctlInventoryEdit->dtgInventoryQuantities->SortInfo, $this->ctlInventoryEdit->dtgInventoryQuantities->LimitInfo, $objExpansionMap);
             $this->ctlInventoryEdit->dtgInventoryQuantities->DataSource = InventoryLocation::LoadArrayByInventoryModelIdLocations($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, $this->ctlInventoryEdit->dtgInventoryQuantities->SortInfo, $this->ctlInventoryEdit->dtgInventoryQuantities->LimitInfo, $objExpansionMap, true);
         }
         $objExpansionMap = null;
         // Specify the local databind method this datagrid will use
         $this->ctlInventoryEdit->dtgInventoryTransaction->SetDataBinder('dtgInventoryTransaction_Bind');
         // Specify the local databind method this datagrid will use
         $this->ctlInventoryEdit->dtgShipmentReceipt->SetDataBinder('dtgShipmentReceipt_Bind');
     }
     // If InventoryLocations are in the array, finish setting up the datagrid of InventorieLocations prepared for a transaction
     if ($this->ctlInventoryTransact->objInventoryLocationArray) {
         // Using the array instead of querying the database again. This means sorting will not work because the db is not being queried each time.
         $this->ctlInventoryTransact->dtgInventoryTransact->TotalItemCount = count($this->ctlInventoryTransact->objInventoryLocationArray);
         $this->ctlInventoryTransact->dtgInventoryTransact->DataSource = $this->ctlInventoryTransact->objInventoryLocationArray;
         $this->ctlInventoryTransact->dtgInventoryTransact->ShowHeader = true;
     } else {
         $this->ctlInventoryTransact->dtgInventoryTransact->TotalItemCount = 0;
         $this->ctlInventoryTransact->dtgInventoryTransact->ShowHeader = false;
     }
 }
 protected function SetupInventoryLocation()
 {
     // Lookup Object PK information from Query String (if applicable)
     // Set mode to Edit or New depending on what's found
     $intInventoryLocationId = QApplication::QueryString('intInventoryLocationId');
     if ($intInventoryLocationId) {
         $this->objInventoryLocation = InventoryLocation::Load($intInventoryLocationId);
         if (!$this->objInventoryLocation) {
             throw new Exception('Could not find a InventoryLocation object with PK arguments: ' . $intInventoryLocationId);
         }
         $this->strTitleVerb = QApplication::Translate('Edit');
         $this->blnEditMode = true;
     } else {
         $this->objInventoryLocation = new InventoryLocation();
         $this->strTitleVerb = QApplication::Translate('Create');
         $this->blnEditMode = false;
     }
 }
Пример #3
0
 protected function UpdateShipmentFields()
 {
     if (!$this->blnEditMode) {
         //$this->objShipment->TransactionId = $this->objTransaction->TransactionId;
         $this->objShipment->Transaction = $this->objTransaction;
     }
     if ($this->blnEditMode) {
         if (!$this->objTransaction) {
             $this->objTransaction = Transaction::Load($this->objShipment->TransactionId);
         }
         $this->objShipment->Transaction = $this->objTransaction;
         $this->objShipment->ShipmentNumber = $this->lblShipmentNumber->Text;
     } elseif (QApplication::$TracmorSettings->CustomShipmentNumbers) {
         $this->objShipment->ShipmentNumber = $this->txtShipmentNumber->Text;
     } else {
         $this->objShipment->ShipmentNumber = Shipment::LoadNewShipmentNumber();
     }
     $this->objShipment->ToContactId = $this->lstToContact->SelectedValue;
     $this->objShipment->FromCompanyId = $this->lstFromCompany->SelectedValue;
     $this->objShipment->FromContactId = $this->lstFromContact->SelectedValue;
     $this->objShipment->ShipDate = $this->calShipDate->DateTime;
     $this->objShipment->FromAddressId = $this->lstFromAddress->SelectedValue;
     $this->objShipment->ToCompanyId = $this->lstToCompany->SelectedValue;
     $this->objShipment->ToAddressId = $this->lstToAddress->SelectedValue;
     $this->objShipment->CourierId = $this->lstCourier->SelectedValue;
     //if (!$this->lstCourier->SelectedValue) {
     $this->objShipment->TrackingNumber = $this->txtTrackingNumber->Text;
     //}
     // Reload the Assets and inventory locations so that they don't trigger an OLE if completing the shipment without reloading after adding an asset or inventory.
     if ($this->objAssetTransactionArray) {
         foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
             $objAssetTransaction->Asset = Asset::Load($objAssetTransaction->AssetId);
         }
     }
     if ($this->objInventoryTransactionArray) {
         foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
             $objInventoryTransaction->InventoryLocation = InventoryLocation::Load($objInventoryTransaction->InventoryLocationId);
         }
     }
 }
Пример #4
0
    /**
     * Deletes all associated InventoryLocations
     * @return void
     */
    public function DeleteAllInventoryLocations()
    {
        if (is_null($this->intLocationId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this unsaved Location.');
        }
        // Get the Database Object for this Class
        $objDatabase = Location::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (InventoryLocation::LoadArrayByLocationId($this->intLocationId) as $objInventoryLocation) {
                $objInventoryLocation->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_location`
				WHERE
					`location_id` = ' . $objDatabase->SqlVariable($this->intLocationId) . '
			');
    }
 public function dtgInventoryLocation_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgInventoryLocation->TotalItemCount = InventoryLocation::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgInventoryLocation->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgInventoryLocation->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgInventoryLocation->DataSource = InventoryLocation::LoadAll($objClauses);
 }
Пример #6
0
 /**
  * Counts all associated InventoryLocations
  * @return int
  */
 public function CountInventoryLocations()
 {
     if (is_null($this->intInventoryModelId)) {
         return 0;
     }
     return InventoryLocation::CountByInventoryModelId($this->intInventoryModelId);
 }
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     if ($this->objInventoryLocationArray) {
         $blnError = false;
         // If it is a move or a restock, lstDestinationLocation cannot be null
         if (($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) && !$this->lstDestinationLocation->SelectedValue) {
             $this->lstDestinationLocation->Warning = 'You must select a destination location.';
             $blnError = true;
         }
         foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
             // TransactionTypeId = 1 is for moves
             if ($this->intTransactionTypeId == 1) {
                 if ($objInventoryLocation->LocationId == $this->lstDestinationLocation->SelectedValue) {
                     $this->dtgInventoryTransact->Warning = 'Cannot move inventory from a location to the same location.';
                     $blnError = true;
                 }
             }
         }
         if (!$blnError) {
             try {
                 // Get an instance of the database
                 $objDatabase = QApplication::$Database[1];
                 // Begin a MySQL Transaction to be either committed or rolled back
                 $objDatabase->TransactionBegin();
                 // Create the new transaction object and save it
                 $this->objTransaction = new Transaction();
                 $this->objTransaction->EntityQtypeId = EntityQtype::Inventory;
                 $this->objTransaction->TransactionTypeId = $this->intTransactionTypeId;
                 $this->objTransaction->Note = $this->txtNote->Text;
                 $this->objTransaction->Save();
                 // Assign different source and destinations depending on transaction type
                 foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
                     // Move
                     if ($this->intTransactionTypeId == 1) {
                         $SourceLocationId = $objInventoryLocation->LocationId;
                         $DestinationLocationId = $this->lstDestinationLocation->SelectedValue;
                     } elseif ($this->intTransactionTypeId == 4) {
                         // LocationId = 4 - 'New Inventory'
                         $SourceLocationId = 4;
                         $DestinationLocationId = $this->lstDestinationLocation->SelectedValue;
                     } elseif ($this->intTransactionTypeId == 5) {
                         $SourceLocationId = $objInventoryLocation->LocationId;
                         // LocationId = 3 - 'Taken Out'
                         $DestinationLocationId = 3;
                     }
                     // Remove the inventory quantity from the source for moves and take outs
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) {
                         //$objInventoryLocation->Quantity = $objInventoryLocation->Quantity - $objInventoryLocation->intTransactionQuantity;
                         $objInventoryLocation->Quantity = $objInventoryLocation->GetVirtualAttribute('actual_quantity') - $objInventoryLocation->intTransactionQuantity;
                         $objInventoryLocation->Save();
                     }
                     // Add the new quantity where it belongs for moves and restocks
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) {
                         $objNewInventoryLocation = InventoryLocation::LoadByLocationIdInventoryModelId($DestinationLocationId, $objInventoryLocation->InventoryModelId);
                         if ($objNewInventoryLocation) {
                             //$objNewInventoryLocation->Quantity = $objNewInventoryLocation->GetVirtualAttribute('actual_quantity') + $objInventoryLocation->intTransactionQuantity;
                             $objNewInventoryLocation->Quantity = $objNewInventoryLocation->Quantity + $objInventoryLocation->intTransactionQuantity;
                         } else {
                             $objNewInventoryLocation = new InventoryLocation();
                             $objNewInventoryLocation->InventoryModelId = $objInventoryLocation->InventoryModelId;
                             $objNewInventoryLocation->Quantity = $objInventoryLocation->intTransactionQuantity;
                         }
                         $objNewInventoryLocation->LocationId = $DestinationLocationId;
                         $objNewInventoryLocation->Save();
                     }
                     // Create the new InventoryTransaction object and save it
                     $this->objInventoryTransaction = new InventoryTransaction();
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) {
                         $this->objInventoryTransaction->InventoryLocationId = $objNewInventoryLocation->InventoryLocationId;
                     } elseif ($this->intTransactionTypeId == 5) {
                         $this->objInventoryTransaction->InventoryLocationId = $objInventoryLocation->InventoryLocationId;
                     }
                     $this->objInventoryTransaction->TransactionId = $this->objTransaction->TransactionId;
                     $this->objInventoryTransaction->Quantity = $objInventoryLocation->intTransactionQuantity;
                     $this->objInventoryTransaction->SourceLocationId = $SourceLocationId;
                     $this->objInventoryTransaction->DestinationLocationId = $DestinationLocationId;
                     $this->objInventoryTransaction->Save();
                 }
                 // Commit the above transactions to the database
                 $objDatabase->TransactionCommit();
                 QApplication::Redirect('../common/transaction_edit.php?intTransactionId=' . $this->objTransaction->TransactionId);
             } catch (QOptimisticLockingException $objExc) {
                 // Rollback the database
                 $objDatabase->TransactionRollback();
                 $objInventoryLocation = InventoryLocation::Load($objExc->EntityId);
                 $this->objParentObject->btnRemove_Click($this->objParentObject->FormId, 'btnRemove' . $objExc->EntityId, $objExc->EntityId);
                 // Lock Exception Thrown, Report the Error
                 $this->btnCancel->Warning = sprintf('The Inventory %s at %s has been altered by another user and removed from the transaction. You may add the inventory again or save the transaction without it.', $objInventoryLocation->InventoryModel->InventoryModelCode, $objInventoryLocation->Location->__toString());
             }
         }
     }
 }
Пример #8
0
 	You will also have to change the asset.location_id to the destination location
 */
 $arrInventoryCodeLocationQuantity = array_unique(explode('#', $_POST['result']));
 $blnError = false;
 $arrCheckedInventoryCodeLocationQuantity = array();
 foreach ($arrInventoryCodeLocationQuantity as $strInventoryCodeLocationQuantity) {
     $blnErrorCurrentInventory = false;
     list($strInventoryModelCode, $strSourceLocation, $intQuantity) = explode('|', $strInventoryCodeLocationQuantity, 3);
     if ($strInventoryModelCode && $strSourceLocation && $intQuantity) {
         $intNewInventoryLocationId = 0;
         // Begin error checking
         // Load the inventory model object based on the inventory_model_code submitted
         $objInventoryModel = InventoryModel::LoadByInventoryModelCode($strInventoryModelCode);
         if ($objInventoryModel) {
             // Load the array of InventoryLocations based on the InventoryModelId of the InventoryModel object
             $InventorySourceLocationArray = InventoryLocation::LoadArrayByInventoryModelIdLocations($objInventoryModel->InventoryModelId);
             if ($InventorySourceLocationArray) {
                 $blnErrorCurrentInventory = true;
                 foreach ($InventorySourceLocationArray as $InventoryLocation) {
                     if ($InventoryLocation->Quantity != 0) {
                         if (strtoupper($InventoryLocation->__toString()) == strtoupper($strSourceLocation)) {
                             $blnErrorCurrentInventory = false;
                             $intNewInventoryLocationId = $InventoryLocation->InventoryLocationId;
                             $objNewInventoryLocation = $InventoryLocation;
                         }
                     }
                 }
                 if ($blnErrorCurrentInventory) {
                     $strWarning .= $strInventoryModelCode . " - There is no source location for that inventory code.<br />";
                     $blnError = true;
                 }
 protected function dtrInventoryLocation_Bind()
 {
     $arrConditions = $this->GetFilterConditions();
     $objOrderByClause = $this->GetOrderByClause();
     $this->dtrInventoryLocation->TotalItemCount = InventoryLocation::QueryCount(QQ::AndCondition($arrConditions), $objOrderByClause);
     $this->dtrInventoryLocation->DataSource = InventoryLocation::QueryArray(QQ::AndCondition($arrConditions), $objOrderByClause);
 }
Пример #10
0
 protected function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     $blnError = false;
     // Do not allow duplicate Location names
     if ($this->blnEditMode) {
         $objLocationDuplicate = Location::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Location()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::Location()->LocationId, $this->objLocation->LocationId)));
     } else {
         $objLocationDuplicate = Location::QuerySingle(QQ::Equal(QQN::Location()->ShortDescription, $this->txtShortDescription->Text));
     }
     if ($objLocationDuplicate) {
         $blnError = true;
         $this->txtShortDescription->Warning = 'This Location Name is already in use. Please try another.';
         $this->txtShortDescription->Focus();
     }
     // Check if there is any inventory at this location
     $objInventoryLocation = InventoryLocation::QuerySingle(QQ::Equal(QQN::InventoryLocation()->LocationId, $this->objLocation->LocationId), QQ::Clause(QQ::Sum(QQN::InventoryLocation()->Quantity, 'QuantityTotal')));
     $intInventoryAtLocation = $objInventoryLocation->GetVirtualAttribute('QuantityTotal');
     // Don't allow disabling of locations with assets or inventory quantities
     if ($this->blnEditMode && $this->objLocation->EnabledFlag && !$this->chkEnabled->Checked && (Asset::CountByLocationId($this->objLocation->LocationId) > 0 || $intInventoryAtLocation > 0)) {
         $blnError = true;
         $this->chkEnabled->Warning = 'Location must be empty before disabling.';
         $this->chkEnabled->Focus();
     }
     if (!$blnError) {
         try {
             $this->UpdateLocationFields();
             $this->objLocation->Save();
             $this->RedirectToListPage();
         } catch (QExtendedOptimisticLockingException $objExc) {
             $this->btnCancel->Warning = sprintf('This location has been updated by another user. You must <a href="location_edit.php?intLocationId=%s">Refresh</a> to edit this location.', $this->objLocation->LocationId);
         }
     }
 }
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = InventoryLocation::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from InventoryLocation, given the clauses above
     $this->DataSource = InventoryLocation::QueryArray($objCondition, $objClauses);
 }
 /**
  * Internally called method to assist with early binding of objects
  * on load methods.  Can only early-bind references that this class owns in the database.
  * @param string $strParentAlias the alias of the parent (if any)
  * @param string $strAlias the alias of this object
  * @param array $objExpansionMap map of referenced columns to be immediately expanded via early-binding
  * @param QueryExpansion an already instantiated QueryExpansion object (used as a utility object to assist with object expansion)
  */
 public static function ExpandQuery($strParentAlias, $strAlias, $objExpansionMap, QQueryExpansion $objQueryExpansion)
 {
     if ($strAlias) {
         $objQueryExpansion->AddFromItem(sprintf('LEFT JOIN `inventory_transaction` AS `%s__%s` ON `%s`.`%s` = `%s__%s`.`inventory_transaction_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`inventory_transaction_id` AS `%s__%s__inventory_transaction_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`inventory_location_id` AS `%s__%s__inventory_location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`transaction_id` AS `%s__%s__transaction_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`quantity` AS `%s__%s__quantity`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`source_location_id` AS `%s__%s__source_location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`destination_location_id` AS `%s__%s__destination_location_id`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`created_by` AS `%s__%s__created_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`creation_date` AS `%s__%s__creation_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_by` AS `%s__%s__modified_by`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $objQueryExpansion->AddSelectItem(sprintf('`%s__%s`.`modified_date` AS `%s__%s__modified_date`', $strParentAlias, $strAlias, $strParentAlias, $strAlias));
         $strParentAlias = $strParentAlias . '__' . $strAlias;
     }
     if (is_array($objExpansionMap)) {
         foreach ($objExpansionMap as $strKey => $objValue) {
             switch ($strKey) {
                 case 'inventory_location_id':
                     try {
                         InventoryLocation::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'transaction_id':
                     try {
                         Transaction::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'source_location_id':
                     try {
                         Location::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'destination_location_id':
                     try {
                         Location::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'created_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 case 'modified_by':
                     try {
                         UserAccount::ExpandQuery($strParentAlias, $strKey, $objValue, $objQueryExpansion);
                         break;
                     } catch (QCallerException $objExc) {
                         $objExc->IncrementOffset();
                         throw $objExc;
                     }
                 default:
                     throw new QCallerException(sprintf('Unknown Object to Expand in %s: %s', $strParentAlias, $strKey));
             }
         }
     }
 }
 public function btnSave_Click($strFormId, $strControlId, $strParameter)
 {
     if ($this->objInventoryLocationArray) {
         $blnError = false;
         // If it is a move or a restock, lstDestinationLocation cannot be null
         if (($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) && !$this->lstDestinationLocation->SelectedValue) {
             $this->lstDestinationLocation->Warning = 'You must select a destination location.';
             $blnError = true;
         }
         foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
             // TransactionTypeId = 1 is for moves
             if ($this->intTransactionTypeId == 1) {
                 if ($objInventoryLocation->LocationId == $this->lstDestinationLocation->SelectedValue) {
                     $this->dtgInventoryTransact->Warning = 'Cannot move inventory from a location to the same location.';
                     $blnError = true;
                 }
             }
         }
         if (!$blnError) {
             try {
                 // Get an instance of the database
                 $objDatabase = QApplication::$Database[1];
                 // Begin a MySQL Transaction to be either committed or rolled back
                 $objDatabase->TransactionBegin();
                 // Create the new transaction object and save it
                 $this->objTransaction = new Transaction();
                 $this->objTransaction->EntityQtypeId = EntityQtype::Inventory;
                 $this->objTransaction->TransactionTypeId = $this->intTransactionTypeId;
                 $this->objTransaction->Note = $this->txtNote->Text;
                 $this->objTransaction->Save();
                 // Assign different source and destinations depending on transaction type
                 foreach ($this->objInventoryLocationArray as $objInventoryLocation) {
                     $xx = InventoryLocation::LoadByLocationIdInventoryModelId(6, $objInventoryLocation->InventoryModelId);
                     if ($xx) {
                         $local_warehouse_stock = $xx->Quantity;
                     } else {
                         $local_warehouse_stock = 0;
                     }
                     $xx = InventoryLocation::LoadByLocationIdInventoryModelId(7, $objInventoryLocation->InventoryModelId);
                     if ($xx) {
                         $bad_products_warehouse_stock = $xx->Quantity;
                     } else {
                         $bad_products_warehouse_stock = 0;
                     }
                     $xx = InventoryLocation::LoadByLocationIdInventoryModelId(8, $objInventoryLocation->InventoryModelId);
                     if ($xx) {
                         $sample_warehouse_stock = $xx->Quantity;
                     } else {
                         $sample_warehouse_stock = 0;
                     }
                     $xx = InventoryLocation::LoadByLocationIdInventoryModelId(9, $objInventoryLocation->InventoryModelId);
                     if ($xx) {
                         $repair_warehouse_stock = $xx->Quantity;
                     } else {
                         $repair_warehouse_stock = 0;
                     }
                     // Move
                     if ($this->intTransactionTypeId == 1) {
                         $SourceLocationId = $objInventoryLocation->LocationId;
                         $DestinationLocationId = $this->lstDestinationLocation->SelectedValue;
                     } elseif ($this->intTransactionTypeId == 4) {
                         // LocationId = 4 - 'New Inventory'
                         $SourceLocationId = 4;
                         $DestinationLocationId = $this->lstDestinationLocation->SelectedValue;
                     } elseif ($this->intTransactionTypeId == 5) {
                         $SourceLocationId = $objInventoryLocation->LocationId;
                         // LocationId = 3 - 'Taken Out'
                         $DestinationLocationId = 3;
                     }
                     // Remove the inventory quantity from the source for moves and take outs
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 5) {
                         $objInventoryLocation->Quantity = $objInventoryLocation->Quantity - $objInventoryLocation->intTransactionQuantity;
                         $objInventoryLocation->Save();
                     }
                     // Add the new quantity where it belongs for moves and restocks
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) {
                         $objNewInventoryLocation = InventoryLocation::LoadByLocationIdInventoryModelId($DestinationLocationId, $objInventoryLocation->InventoryModelId);
                         if ($objNewInventoryLocation) {
                             $objNewInventoryLocation->Quantity = $objNewInventoryLocation->Quantity + $objInventoryLocation->intTransactionQuantity;
                         } else {
                             $objNewInventoryLocation = new InventoryLocation();
                             $objNewInventoryLocation->InventoryModelId = $objInventoryLocation->InventoryModelId;
                             $objNewInventoryLocation->Quantity = $objInventoryLocation->intTransactionQuantity;
                         }
                         $objNewInventoryLocation->LocationId = $DestinationLocationId;
                         $objNewInventoryLocation->Save();
                     }
                     // Create the new InventoryTransaction object and save it
                     $this->objInventoryTransaction = new InventoryTransaction();
                     if ($this->intTransactionTypeId == 1 || $this->intTransactionTypeId == 4) {
                         $this->objInventoryTransaction->InventoryLocationId = $objNewInventoryLocation->InventoryLocationId;
                     } elseif ($this->intTransactionTypeId == 5) {
                         $this->objInventoryTransaction->InventoryLocationId = $objInventoryLocation->InventoryLocationId;
                     }
                     $this->objInventoryTransaction->TransactionId = $this->objTransaction->TransactionId;
                     $this->objInventoryTransaction->Quantity = $objInventoryLocation->intTransactionQuantity;
                     $this->objInventoryTransaction->SourceLocationId = $SourceLocationId;
                     $this->objInventoryTransaction->DestinationLocationId = $DestinationLocationId;
                     $this->objInventoryTransaction->LocalWarehouseStock = $local_warehouse_stock;
                     $this->objInventoryTransaction->BadProductsWarehouseStock = $bad_products_warehouse_stock;
                     $this->objInventoryTransaction->SampleWarehouseStock = $sample_warehouse_stock;
                     $this->objInventoryTransaction->RepairWarehouseStock = $repair_warehouse_stock;
                     $this->objInventoryTransaction->Save();
                     /*
                     $this->http_post("http://127.0.0.1:8080/inventory/service.php", 'updateVirtualStock', array(
                     	//'byName' => '',
                     	'inventory_model_id' => $objInventoryLocation->InventoryModelId,
                     	'virtualStock' => $objInventoryLocation->intTransactionQuantity,
                     	'operate' => '+'
                     	)
                     );
                     */
                 }
                 // Commit the above transactions to the database
                 $objDatabase->TransactionCommit();
                 QApplication::Redirect('../common/transaction_edit.php?intTransactionId=' . $this->objTransaction->TransactionId);
             } catch (QOptimisticLockingException $objExc) {
                 // Rollback the database
                 $objDatabase->TransactionRollback();
                 $objInventoryLocation = InventoryLocation::Load($objExc->EntityId);
                 $this->objParentObject->btnRemove_Click($this->objParentObject->FormId, 'btnRemove' . $objExc->EntityId, $objExc->EntityId);
                 // Lock Exception Thrown, Report the Error
                 $this->btnCancel->Warning = sprintf('The Inventory %s at %s has been altered by another user and removed from the transaction. You may add the inventory again or save the transaction without it.', $objInventoryLocation->InventoryModel->InventoryModelCode, $objInventoryLocation->Location->__toString());
             }
         }
     }
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this InventoryLocationMetaControl
  * @param integer $intInventoryLocationId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing InventoryLocation object creation - defaults to CreateOrEdit
  * @return InventoryLocationMetaControl
  */
 public static function Create($objParentObject, $intInventoryLocationId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intInventoryLocationId)) {
         $objInventoryLocation = InventoryLocation::Load($intInventoryLocationId);
         // InventoryLocation was found -- return it!
         if ($objInventoryLocation) {
             return new InventoryLocationMetaControl($objParentObject, $objInventoryLocation);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a InventoryLocation object with PK arguments: ' . $intInventoryLocationId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new InventoryLocationMetaControl($objParentObject, new InventoryLocation());
 }
Пример #15
0
 $objTransaction->Save();
 // Assign different source and destinations depending on transaction type
 foreach ($objInventoryLocationArray as $objInventoryLocation) {
     // Move
     $SourceLocationId = $objInventoryLocation->LocationId;
     $DestinationLocationId = $objDestinationLocation->LocationId;
     // Remove the inventory quantity from the source for moves and take outs
     //$objInventoryLocation->Quantity = $objInventoryLocation->Quantity - $objInventoryLocation->intTransactionQuantity;
     $objInventoryLocation->Quantity = $objInventoryLocation->GetVirtualAttribute('actual_quantity') - $objInventoryLocation->intTransactionQuantity;
     $objInventoryLocation->Save();
     // Add the new quantity where it belongs for moves and restocks
     $objNewInventoryLocation = InventoryLocation::LoadByLocationIdInventoryModelId($DestinationLocationId, $objInventoryLocation->InventoryModelId);
     if ($objNewInventoryLocation) {
         $objNewInventoryLocation->Quantity = $objNewInventoryLocation->Quantity + $objInventoryLocation->intTransactionQuantity;
     } else {
         $objNewInventoryLocation = new InventoryLocation();
         $objNewInventoryLocation->InventoryModelId = $objInventoryLocation->InventoryModelId;
         $objNewInventoryLocation->Quantity = $objInventoryLocation->intTransactionQuantity;
     }
     $objNewInventoryLocation->LocationId = $DestinationLocationId;
     $objNewInventoryLocation->Save();
     // Create the new InventoryTransaction object and save it
     $objInventoryTransaction = new InventoryTransaction();
     $objInventoryTransaction->InventoryLocationId = $objNewInventoryLocation->InventoryLocationId;
     $objInventoryTransaction->TransactionId = $objTransaction->TransactionId;
     $objInventoryTransaction->Quantity = $objInventoryLocation->intTransactionQuantity;
     $objInventoryTransaction->SourceLocationId = $SourceLocationId;
     $objInventoryTransaction->DestinationLocationId = $DestinationLocationId;
     $objInventoryTransaction->Save();
 }
 $strWarning .= "Your transaction has successfully completed<br /><a href='index.php'>Main Menu</a> | <a href='inventory_menu.php'>Inventory Menu</a><br />";
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objInventoryLocation) {
         $objObject->objInventoryLocation = InventoryLocation::GetSoapObjectFromObject($objObject->objInventoryLocation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intInventoryLocationId = null;
         }
     }
     if ($objObject->objTransaction) {
         $objObject->objTransaction = Transaction::GetSoapObjectFromObject($objObject->objTransaction, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intTransactionId = null;
         }
     }
     if ($objObject->objSourceLocation) {
         $objObject->objSourceLocation = Location::GetSoapObjectFromObject($objObject->objSourceLocation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intSourceLocationId = null;
         }
     }
     if ($objObject->objDestinationLocation) {
         $objObject->objDestinationLocation = Location::GetSoapObjectFromObject($objObject->objDestinationLocation, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intDestinationLocationId = null;
         }
     }
     if ($objObject->objCreatedByObject) {
         $objObject->objCreatedByObject = UserAccount::GetSoapObjectFromObject($objObject->objCreatedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intCreatedBy = null;
         }
     }
     if ($objObject->dttCreationDate) {
         $objObject->dttCreationDate = $objObject->dttCreationDate->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objModifiedByObject) {
         $objObject->objModifiedByObject = UserAccount::GetSoapObjectFromObject($objObject->objModifiedByObject, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intModifiedBy = null;
         }
     }
     return $objObject;
 }
Пример #17
0
                         $objAuditScan->SystemCount = $objNewInventoryLocation->Quantity;
                     } else {
                         $objAuditScan->SystemCount = 0;
                     }
                     $objAuditScanArray[] = $objAuditScan;
                 }
             }
         }
     }
 }
 // Submit
 if (!$blnError) {
     // Add missing inventories that should have been at a location covered by the audit session but were not scanned
     if ($intLocationIdArray) {
         foreach ($intLocationIdArray as $intLocationId) {
             $objInventoryLocationArray = InventoryLocation::LoadArrayByLocationId($intLocationId);
             if ($objInventoryLocationArray) {
                 foreach ($objInventoryLocationArray as $objInventory) {
                     if (!in_array($objInventory->InventoryModelId, $intInventoryIdArray)) {
                         $objNewAuditScan = new AuditScan();
                         $objNewAuditScan->LocationId = $intLocationId;
                         $objNewAuditScan->EntityId = $objInventory->InventoryModelId;
                         $objNewAuditScan->Count = 0;
                         $objNewAuditScan->SystemCount = $objInventory->Quantity;
                         $objAuditScanArray[] = $objNewAuditScan;
                         unset($objNewAuditScan);
                     }
                 }
             }
         }
     }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, InventoryLocation::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 protected function lstInventoryLocation_Create()
 {
     $this->lstInventoryLocation = new QListBox($this);
     $this->lstInventoryLocation->Name = QApplication::Translate('Inventory Location');
     $this->lstInventoryLocation->Required = true;
     if (!$this->blnEditMode) {
         $this->lstInventoryLocation->AddItem(QApplication::Translate('- Select One -'), null);
     }
     $objInventoryLocationArray = InventoryLocation::LoadAll();
     if ($objInventoryLocationArray) {
         foreach ($objInventoryLocationArray as $objInventoryLocation) {
             $objListItem = new QListItem($objInventoryLocation->__toString(), $objInventoryLocation->InventoryLocationId);
             if ($this->objInventoryTransaction->InventoryLocation && $this->objInventoryTransaction->InventoryLocation->InventoryLocationId == $objInventoryLocation->InventoryLocationId) {
                 $objListItem->Selected = true;
             }
             $this->lstInventoryLocation->AddItem($objListItem);
         }
     }
 }
 protected function dtgInventoryLocation_Bind()
 {
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgInventoryLocation->TotalItemCount = InventoryLocation::CountAll();
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgInventoryLocation->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgInventoryLocation->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all InventoryLocation objects, given the clauses above
     $this->dtgInventoryLocation->DataSource = InventoryLocation::LoadAll($objClauses);
 }
Пример #21
0
    /**
     * Count InventoryLocations
     * by InventoryModelId Index(es)
     * @param integer $intInventoryModelId
     * @return int
     */
    public static function CountByInventoryModelIdLocations($intInventoryModelId)
    {
        // Call to ArrayQueryHelper to Get Database Object and Get SQL Clauses
        InventoryLocation::QueryHelper($objDatabase);
        // Properly Escape All Input Parameters using Database->SqlVariable()
        $intInventoryModelId = $objDatabase->SqlVariable($intInventoryModelId, true);
        // Setup the SQL Query
        $strQuery = sprintf('
				SELECT
					COUNT(*) AS row_count
				FROM
					`inventory_location`
				WHERE
					`inventory_model_id` %s
					AND `inventory_location`.`location_id` > 5', $intInventoryModelId);
        // Perform the Query and Return the Count
        $objDbResult = $objDatabase->Query($strQuery);
        $strDbRow = $objDbResult->FetchRow();
        return QType::Cast($strDbRow[0], QType::Integer);
    }
 /**
  * Refresh this MetaControl with Data from the local InventoryTransaction object.
  * @param boolean $blnReload reload InventoryTransaction from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objInventoryTransaction->Reload();
     }
     if ($this->lblInventoryTransactionId) {
         if ($this->blnEditMode) {
             $this->lblInventoryTransactionId->Text = $this->objInventoryTransaction->InventoryTransactionId;
         }
     }
     if ($this->lstInventoryLocation) {
         $this->lstInventoryLocation->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstInventoryLocation->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objInventoryLocationArray = InventoryLocation::LoadAll();
         if ($objInventoryLocationArray) {
             foreach ($objInventoryLocationArray as $objInventoryLocation) {
                 $objListItem = new QListItem($objInventoryLocation->__toString(), $objInventoryLocation->InventoryLocationId);
                 if ($this->objInventoryTransaction->InventoryLocation && $this->objInventoryTransaction->InventoryLocation->InventoryLocationId == $objInventoryLocation->InventoryLocationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstInventoryLocation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblInventoryLocationId) {
         $this->lblInventoryLocationId->Text = $this->objInventoryTransaction->InventoryLocation ? $this->objInventoryTransaction->InventoryLocation->__toString() : null;
     }
     if ($this->lstTransaction) {
         $this->lstTransaction->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstTransaction->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTransactionArray = Transaction::LoadAll();
         if ($objTransactionArray) {
             foreach ($objTransactionArray as $objTransaction) {
                 $objListItem = new QListItem($objTransaction->__toString(), $objTransaction->TransactionId);
                 if ($this->objInventoryTransaction->Transaction && $this->objInventoryTransaction->Transaction->TransactionId == $objTransaction->TransactionId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstTransaction->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTransactionId) {
         $this->lblTransactionId->Text = $this->objInventoryTransaction->Transaction ? $this->objInventoryTransaction->Transaction->__toString() : null;
     }
     if ($this->txtQuantity) {
         $this->txtQuantity->Text = $this->objInventoryTransaction->Quantity;
     }
     if ($this->lblQuantity) {
         $this->lblQuantity->Text = $this->objInventoryTransaction->Quantity;
     }
     if ($this->lstSourceLocation) {
         $this->lstSourceLocation->RemoveAllItems();
         $this->lstSourceLocation->AddItem(QApplication::Translate('- Select One -'), null);
         $objSourceLocationArray = Location::LoadAll();
         if ($objSourceLocationArray) {
             foreach ($objSourceLocationArray as $objSourceLocation) {
                 $objListItem = new QListItem($objSourceLocation->__toString(), $objSourceLocation->LocationId);
                 if ($this->objInventoryTransaction->SourceLocation && $this->objInventoryTransaction->SourceLocation->LocationId == $objSourceLocation->LocationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSourceLocation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSourceLocationId) {
         $this->lblSourceLocationId->Text = $this->objInventoryTransaction->SourceLocation ? $this->objInventoryTransaction->SourceLocation->__toString() : null;
     }
     if ($this->lstDestinationLocation) {
         $this->lstDestinationLocation->RemoveAllItems();
         $this->lstDestinationLocation->AddItem(QApplication::Translate('- Select One -'), null);
         $objDestinationLocationArray = Location::LoadAll();
         if ($objDestinationLocationArray) {
             foreach ($objDestinationLocationArray as $objDestinationLocation) {
                 $objListItem = new QListItem($objDestinationLocation->__toString(), $objDestinationLocation->LocationId);
                 if ($this->objInventoryTransaction->DestinationLocation && $this->objInventoryTransaction->DestinationLocation->LocationId == $objDestinationLocation->LocationId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDestinationLocation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDestinationLocationId) {
         $this->lblDestinationLocationId->Text = $this->objInventoryTransaction->DestinationLocation ? $this->objInventoryTransaction->DestinationLocation->__toString() : null;
     }
     if ($this->lstCreatedByObject) {
         $this->lstCreatedByObject->RemoveAllItems();
         $this->lstCreatedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objCreatedByObjectArray = UserAccount::LoadAll();
         if ($objCreatedByObjectArray) {
             foreach ($objCreatedByObjectArray as $objCreatedByObject) {
                 $objListItem = new QListItem($objCreatedByObject->__toString(), $objCreatedByObject->UserAccountId);
                 if ($this->objInventoryTransaction->CreatedByObject && $this->objInventoryTransaction->CreatedByObject->UserAccountId == $objCreatedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstCreatedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblCreatedBy) {
         $this->lblCreatedBy->Text = $this->objInventoryTransaction->CreatedByObject ? $this->objInventoryTransaction->CreatedByObject->__toString() : null;
     }
     if ($this->calCreationDate) {
         $this->calCreationDate->DateTime = $this->objInventoryTransaction->CreationDate;
     }
     if ($this->lblCreationDate) {
         $this->lblCreationDate->Text = sprintf($this->objInventoryTransaction->CreationDate) ? $this->objInventoryTransaction->__toString($this->strCreationDateDateTimeFormat) : null;
     }
     if ($this->lstModifiedByObject) {
         $this->lstModifiedByObject->RemoveAllItems();
         $this->lstModifiedByObject->AddItem(QApplication::Translate('- Select One -'), null);
         $objModifiedByObjectArray = UserAccount::LoadAll();
         if ($objModifiedByObjectArray) {
             foreach ($objModifiedByObjectArray as $objModifiedByObject) {
                 $objListItem = new QListItem($objModifiedByObject->__toString(), $objModifiedByObject->UserAccountId);
                 if ($this->objInventoryTransaction->ModifiedByObject && $this->objInventoryTransaction->ModifiedByObject->UserAccountId == $objModifiedByObject->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstModifiedByObject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblModifiedBy) {
         $this->lblModifiedBy->Text = $this->objInventoryTransaction->ModifiedByObject ? $this->objInventoryTransaction->ModifiedByObject->__toString() : null;
     }
     if ($this->lblModifiedDate) {
         if ($this->blnEditMode) {
             $this->lblModifiedDate->Text = $this->objInventoryTransaction->ModifiedDate;
         }
     }
 }
Пример #23
0
 protected function UpdateReceiptFields()
 {
     $this->objReceipt->TransactionId = $this->objTransaction->TransactionId;
     if (QApplication::$TracmorSettings->CustomReceiptNumbers) {
         $this->objReceipt->ReceiptNumber = $this->txtReceiptNumber->Text;
     } elseif (!$this->blnEditMode) {
         $this->objReceipt->ReceiptNumber = Receipt::LoadNewReceiptNumber();
     }
     $this->objReceipt->FromCompanyId = $this->lstFromCompany->SelectedValue;
     $this->objReceipt->FromContactId = $this->lstFromContact->SelectedValue;
     $this->objReceipt->ToContactId = $this->lstToContact->SelectedValue;
     $this->objReceipt->ToAddressId = $this->lstToAddress->SelectedValue;
     $this->objReceipt->DueDate = $this->calDueDate->DateTime;
     $this->objReceipt->ReceiptDate = $this->calDateReceived->DateTime;
     //!
     $this->objTransaction->Note = $this->txtNote->Text;
     // Reload the Assets and inventory locations so that they don't trigger an OLE if edit/save adding assets or inventory multiple times
     if ($this->objAssetTransactionArray) {
         foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
             $objAssetTransaction->Asset = Asset::Load($objAssetTransaction->AssetId);
         }
     }
     if ($this->objInventoryTransactionArray) {
         foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) {
             $objInventoryTransaction->InventoryLocation = InventoryLocation::Load($objInventoryTransaction->InventoryLocationId);
         }
     }
 }
Пример #24
0
 /**
  * Counts all associated InventoryLocationsAsModifiedBy
  * @return int
  */
 public function CountInventoryLocationsAsModifiedBy()
 {
     if (is_null($this->intUserAccountId)) {
         return 0;
     }
     return InventoryLocation::CountByModifiedBy($this->intUserAccountId);
 }