Ejemplo n.º 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);
         }
         $this->ctlInventoryEdit->dtgInventoryDateQuantities->TotalItemCount = SkuDateQtyHistory::CountBySku($this->ctlInventoryEdit->objInventoryModel->InventoryModelCode);
         if ($this->ctlInventoryEdit->dtgInventoryDateQuantities->TotalItemCount == 0) {
             $this->ctlInventoryEdit->dtgInventoryDateQuantities->ShowHeader = false;
         } else {
             $this->ctlInventoryEdit->dtgInventoryDateQuantities->ShowHeader = true;
             $tmp = explode(",", $this->ctlInventoryEdit->dtgInventoryDateQuantities->LimitInfo);
             $this->ctlInventoryEdit->dtgInventoryDateQuantities->DataSource = SkuDateQtyHistory::LoadArrayBySku($this->ctlInventoryEdit->objInventoryModel->InventoryModelCode, QQ::Clause(QQ::OrderBy(QQN::SkuDateQtyHistory()->Date, false), QQ::LimitInfo($tmp[1], $tmp[0])));
             //print_r($this->ctlInventoryEdit->dtgInventoryDateQuantities->DataSource);
         }
         $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;
     }
 }
Ejemplo n.º 2
0
 public static function CountBySku($stringSku)
 {
     return SkuDateQtyHistory::QueryCount(QQ::Equal(QQN::SkuDateQtyHistory()->Sku, $stringSku));
 }