本文整理汇总了PHP中Shipment::QueryCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::QueryCount方法的具体用法?PHP Shipment::QueryCount怎么用?PHP Shipment::QueryCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shipment
的用法示例。
在下文中一共展示了Shipment::QueryCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CountByFromCompanyId
/**
* Count Shipments
* by FromCompanyId Index(es)
* @param integer $intFromCompanyId
* @return int
*/
public static function CountByFromCompanyId($intFromCompanyId)
{
// Call Shipment::QueryCount to perform the CountByFromCompanyId query
return Shipment::QueryCount(QQ::Equal(QQN::Shipment()->FromCompanyId, $intFromCompanyId));
}
示例2: btnApply_Click
public function btnApply_Click($strFormId, $strControlId, $strParameter)
{
$this->clearWarnings();
$blnError = false;
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
// Check "Contact To", "Contact From", "Coutrier" wasn't changed for shipped items
if (Shipment::QueryCount(QQ::AndCondition(QQ::Equal(QQN::Shipment()->ShippedFlag, 1), QQ::In(QQN::Shipment()->ShipmentId, $this->arrShipmentToEdit))) > 0 && ($this->chkToCompany->Checked || $this->chkFromCompany->Checked || $this->chkCourier->Checked)) {
$this->lblWarning->Text = '"To Company", "From Company", "Courier" shouldn\'t be changed for already
Shipped items';
$blnError = true;
}
if (!$blnError) {
// Apply checked main_table fields
$set = array(sprintf('`modified_by`= %s', QApplication::$objUserAccount->UserAccountId));
if ($this->chkToCompany->Checked) {
if ($this->lstToCompany->SelectedValue) {
$set[] = sprintf('`to_company_id`="%s"', $this->lstToCompany->SelectedValue);
} else {
$this->lstToCompany->Warning = 'Company name must be chosen';
$blnError = true;
}
if ($this->lstToContact->SelectedValue) {
$set[] = sprintf('`to_contact_id`="%s"', $this->lstToContact->SelectedValue);
} else {
$this->lstToContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
if ($this->lstToAddress->SelectedValue) {
$set[] = sprintf('`to_address_id`="%s"', $this->lstToAddress->SelectedValue);
} else {
$this->lstToContact->Warning = 'Address name must be chosen';
$blnError = true;
}
}
if ($this->chkFromCompany->Checked) {
if ($this->lstFromCompany->SelectedValue) {
$set[] = sprintf('`from_company_id`="%s"', $this->lstFromCompany->SelectedValue);
} else {
$this->lstFromCompany->Warning = 'Company name must be chosen';
$blnError = true;
}
if ($this->lstFromContact->SelectedValue) {
$set[] = sprintf('`from_contact_id`="%s"', $this->lstFromContact->SelectedValue);
} else {
$this->lstFromContact->Warning = 'Contact name must be chosen';
$blnError = true;
}
if ($this->lstFromAddress->SelectedValue) {
$set[] = sprintf('`from_address_id`="%s"', $this->lstFromAddress->SelectedValue);
} else {
$this->lstFromAddress->Warning = 'Address name must be chosen';
$blnError = true;
}
}
if ($this->chkCourier->Checked) {
$set[] = sprintf('`courier_id`="%s"', $this->lstCourier->SelectedValue);
}
if ($this->chkShipDate->Checked && $this->calShipDate->DateTime) {
$set[] = sprintf('`ship_date`="%s"', $this->calShipDate->DateTime->__toString('YYYY-MM-DD'));
}
}
if (count($this->arrCustomFields) > 0) {
$customFieldIdArray = array();
foreach ($this->arrCustomFields as $field) {
if ($this->arrCheckboxes[$field['input']->strControlId]->Checked) {
if ($field['input'] instanceof QTextBox && $field['input']->Required && $field['input']->Text == null || $field['input'] instanceof QListBox && $field['input']->Required && $field['input']->SelectedValue == null) {
$blnError = true;
$field['input']->Warning = "Required.";
} else {
$this->arrCustomFieldsToEdit[] = $field;
$customFieldIdArray[] = (int) str_replace('cf', '', $field['input']->strControlId);
}
}
}
}
// Apdate main table
if (!$blnError) {
try {
// Edit Transactions
foreach ($this->arrShipmentToEdit as $intShipmetId) {
$objTransaction = Transaction::Load(Shipment::Load($intShipmetId)->Transaction->TransactionId);
$objTransaction->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
if ($this->chkNote->Checked) {
$objTransaction->Note = $this->txtNote->Text;
}
$objTransaction->Save();
}
if (count($this->arrCustomFieldsToEdit) > 0) {
// preparing data to edit
// Save the values from all of the custom field controls to save the asset
foreach ($this->arrShipmentToEdit as $intShipmentId) {
$objCustomFieldsArray = CustomField::LoadObjCustomFieldArray(EntityQtype::Shipment, false);
$selectedCustomFieldsArray = array();
foreach ($objCustomFieldsArray as $objCustomField) {
if (in_array($objCustomField->CustomFieldId, $customFieldIdArray)) {
$selectedCustomFieldsArray[] = $objCustomField;
}
}
//.........这里部分代码省略.........
示例3: MetaDataBinder
/**
* 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 = Shipment::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 Shipment, given the clauses above
$this->DataSource = Shipment::QueryArray($objCondition, $objClauses);
}
示例4: hasCompany
/**
* Check if Shipment contains company
* by CompanyId Index(es)
* @param integer $intCompanyId
* @return bool
*/
public static function hasCompany($intCompanyId)
{
try {
$intShipments = Shipment::QueryCount(QQ::OrCondition(QQ::Equal(QQN::Shipment()->FromCompanyId, $intCompanyId), QQ::Equal(QQN::Shipment()->ToCompanyId, $intCompanyId)));
return $intShipments > 0 ? true : false;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}