本文整理汇总了PHP中GetNextTransNo函数的典型用法代码示例。如果您正苦于以下问题:PHP GetNextTransNo函数的具体用法?PHP GetNextTransNo怎么用?PHP GetNextTransNo使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNextTransNo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
echo '<tr><td colspan="3"></td><td><hr/></td><td colspan="2"></td><td colspan="3"><hr></td></tr>';
echo '<tr><td colspan="2" align="right">' . _('Totals') . '</td>
<td></td>
<td>' . number_format($TotalReqdCost, 2) . '</td>
<td></td><td></td>
<td>' . number_format($TotalIssuedCost, 2) . '</td>
<td align="right">' . number_format($TotalUsageVar, 2) . '</td>
<td align="right">' . number_format($TotalCostVar, 2) . '</td></tr>';
echo '<tr><td colspan="3"></td><td><hr/></td><td colspan="2"></td><td colspan="3"><hr></td></tr>';
#echo '<tr><td colspan="7"></td><td colspan="2"><hr></td></tr>';
if (isset($_POST['Close'])) {
DB_data_seek($WOItemsResult, 0);
$NoItemsOnWO = DB_num_rows($WOItemsResult);
$TotalVariance = $TotalUsageVar + $TotalCostVar;
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$WOCloseNo = GetNextTransNo(29, $db);
$TransResult = DB_Txn_Begin($db);
while ($WORow = DB_fetch_array($WOItemsResult)) {
if ($TotalStdValueRecd == 0) {
$ShareProportion = 1 / $NoItemsOnWO;
} else {
$ShareProportion = $WORow['stdcost'] * $WORow['qtyrecd'] / $TotalStdValueRecd;
}
if ($_SESSION['WeightedAverageCosting'] == 1) {
//we need to post the variances to stock and update the weighted average cost
/* need to get the current total quantity on hand
if the quantity on hand is less than the quantity received on the work order
then some of the variance needs to be written off to P & L and only the proportion
of the variance relating to the stock still on hand should be posted to the stock value
*/
$TotOnHandResult = DB_query("SELECT SUM(quantity)\n\t\t\t\t\t\t\tFROM locstock\n\t\t\t\t\t\t\tWHERE stockid='" . $WORow['stockid'] . "'", $db);
示例2: Save
function Save()
{
global $db;
if ($this->OrderNumber == 0) {
$this->OrderNumber = GetNextTransNo(40, $db);
$sql = "INSERT INTO workorders (wo,\n\t\t\t\t\t\t\t\t\t\t\tloccode,\n\t\t\t\t\t\t\t\t\t\t\trequiredby,\n\t\t\t\t\t\t\t\t\t\t\tstartdate,\n\t\t\t\t\t\t\t\t\t\t\tcostissued)\n\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->OrderNumber . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->LocationCode . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($this->RequiredBy) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($this->StartDate) . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $this->CostIssued . "'\n\t\t\t\t\t\t\t\t\t\t)";
} else {
$sql = "UPDATE workorders SET loccode='" . $this->LocationCode . "',\n\t\t\t\t\t\t\t\t\t\t\trequiredby='" . FormatDateForSQL($this->RequiredBy) . "',\n\t\t\t\t\t\t\t\t\t\t\tstartdate='" . FormatDateForSQL($this->StartDate) . "',\n\t\t\t\t\t\t\t\t\t\t\tcostissued='" . $this->CostIssued . "'\n\t\t\t\t\t\t\t\t\t\tWHERE wo='" . $this->OrderNumber . "'";
}
$UpdateWOResult = DB_query($sql, $db);
foreach ($this->Items as $i => $Item) {
$Item->Save($this->OrderNumber);
}
}
示例3: save
function save($db)
{
/* Does record exist for this tender
*/
if ($this->TenderId == '') {
$this->TenderId = GetNextTransNo(37, $db);
$HeaderSQL = "INSERT INTO tenders (tenderid,\n\t\t\t\t\t\t\t\t\t\t\tlocation,\n\t\t\t\t\t\t\t\t\t\t\taddress1,\n\t\t\t\t\t\t\t\t\t\t\taddress2,\n\t\t\t\t\t\t\t\t\t\t\taddress3,\n\t\t\t\t\t\t\t\t\t\t\taddress4,\n\t\t\t\t\t\t\t\t\t\t\taddress5,\n\t\t\t\t\t\t\t\t\t\t\taddress6,\n\t\t\t\t\t\t\t\t\t\t\ttelephone,\n\t\t\t\t\t\t\t\t\t\t\trequiredbydate)\n\t\t\t\t\t\t\t\tVALUES ('" . $this->TenderId . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->Location . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd1 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd2 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd3 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd4 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd5 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->DelAdd6 . "',\n\t\t\t\t\t\t\t\t\t\t'" . $this->Telephone . "',\n\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($this->RequiredByDate) . "')";
foreach ($this->Suppliers as $Supplier) {
$SuppliersSQL[] = "INSERT INTO tendersuppliers (tenderid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsupplierid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\temail)\n\t\t\t\t\t\t\t\tVALUES ('" . $this->TenderId . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Supplier->SupplierCode . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Supplier->EmailAddress . "')";
}
foreach ($this->LineItems as $LineItem) {
$ItemsSQL[] = "INSERT INTO tenderitems (tenderid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunits)\n\t\t\t\t\t\t\t\t\t\t\tVALUES ('" . $this->TenderId . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItem->StockID . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItem->Quantity . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItem->Units . "')";
}
} else {
$HeaderSQL = "UPDATE tenders SET location='" . $this->Location . "',\n\t\t\t\t\t\t\t\t\t\t\taddress1='" . $this->DelAdd1 . "',\n\t\t\t\t\t\t\t\t\t\t\taddress2='" . $this->DelAdd2 . "',\n\t\t\t\t\t\t\t\t\t\t\taddress3='" . $this->DelAdd3 . "',\n\t\t\t\t\t\t\t\t\t\t\taddress4='" . $this->DelAdd4 . "',\n\t\t\t\t\t\t\t\t\t\t\taddress5='" . $this->DelAdd5 . "',\n\t\t\t\t\t\t\t\t\t\t\taddress6='" . $this->DelAdd6 . "',\n\t\t\t\t\t\t\t\t\t\t\ttelephone='" . $this->Telephone . "',\n\t\t\t\t\t\t\t\t\t\t\trequiredbydate='" . FormatDateForSQL($this->RequiredByDate) . "'\n\t\t\t\t\t\tWHERE tenderid = '" . $this->TenderId . "'";
foreach ($this->Suppliers as $Supplier) {
$sql = "DELETE FROM tendersuppliers\n\t\t\t\t\tWHERE tenderid='" . $this->TenderId . "'";
$result = DB_query($sql, $db);
$SuppliersSQL[] = "INSERT INTO tendersuppliers (\n\t\t\t\t\t\t\t\t\ttenderid,\n\t\t\t\t\t\t\t\t\tsupplierid,\n\t\t\t\t\t\t\t\t\temail)\n\t\t\t\t\t\t\t\tVALUES ('" . $this->TenderId . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Supplier->SupplierCode . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Supplier->EmailAddress . "')";
}
foreach ($this->LineItems as $LineItem) {
$sql = "DELETE FROM tenderitems\n\t\t\t\t\t\tWHERE tenderid='" . $this->TenderId . "'";
$result = DB_query($sql, $db);
$ItemsSQL[] = "INSERT INTO tenderitems (tenderid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tunits)\n\t\t\t\t\t\t\t\tVALUES ('" . $this->TenderId . "',\n\t\t\t\t\t\t\t\t\t\t'" . $LineItem->StockID . "',\n\t\t\t\t\t\t\t\t\t\t'" . $LineItem->Quantity . "',\n\t\t\t\t\t\t\t\t\t\t'" . $LineItem->Units . "')";
}
}
DB_Txn_Begin($db);
$result = DB_query($HeaderSQL, $db, '', '', True);
foreach ($SuppliersSQL as $sql) {
$result = DB_query($sql, $db, '', '', True);
}
foreach ($ItemsSQL as $sql) {
$result = DB_query($sql, $db, '', '', True);
}
DB_Txn_Commit($db);
}
示例4: foreach
}
if ($InputError == 1) {
foreach ($msg as $message) {
prnMsg($message, 'info');
}
} else {
$SalesAreaSQL = "SELECT areacode FROM areas";
$SalesAreaResult = DB_query($SalesAreaSQL, $db);
$SalesAreaRow = DB_fetch_array($SalesAreaResult);
$SalesManSQL = "SELECT salesmancode FROM salesman";
$SalesManResult = DB_query($SalesManSQL, $db);
$SalesManRow = DB_fetch_array($SalesManResult);
if ($_SESSION['AutoDebtorNo'] > 0) {
/* system assigned, sequential, numeric */
if ($_SESSION['AutoDebtorNo'] == 1) {
$_POST['FileNumber'] = GetNextTransNo(500, $db);
}
}
$sql = "INSERT INTO debtorsmaster (debtorno,\n\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\taddress1,\n\t\t\t\t\t\t\t\t\t\taddress2,\n\t\t\t\t\t\t\t\t\t\taddress3,\n\t\t\t\t\t\t\t\t\t\taddress4,\n\t\t\t\t\t\t\t\t\t\taddress5,\n\t\t\t\t\t\t\t\t\t\taddress6,\n\t\t\t\t\t\t\t\t\t\tcurrcode,\n\t\t\t\t\t\t\t\t\t\tsalestype,\n\t\t\t\t\t\t\t\t\t\tclientsince,\n\t\t\t\t\t\t\t\t\t\tholdreason,\n\t\t\t\t\t\t\t\t\t\tpaymentterms)\n\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['FileNumber'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Name'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address1'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address2'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address3'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address4'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address5'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Address6'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['CompanyRecord']['currencydefault'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['SalesType'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['DateOfBirth']) . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Sex'] . "',\n\t\t\t\t\t\t\t\t\t\t'20'\n\t\t\t\t\t\t\t\t\t)";
$result = DB_query($sql, $db);
$sql = "INSERT INTO custbranch (branchcode,\n\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\tbrname,\n\t\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\t\tsalesman,\n\t\t\t\t\t\t\t\t\t\tphoneno,\n\t\t\t\t\t\t\t\t\t\tdefaultlocation,\n\t\t\t\t\t\t\t\t\t\ttaxgroupid)\n\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t'CASH',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['FileNumber'] . "',\n\t\t\t\t\t\t\t\t\t\t'CASH',\n\t\t\t\t\t\t\t\t\t\t'" . $SalesAreaRow['areacode'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $SalesManRow['salesmancode'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['Telephone'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['DefaultFactoryLocation'] . "',\n\t\t\t\t\t\t\t\t\t\t'1'\n\t\t\t\t\t\t\t\t\t)";
$result = DB_query($sql, $db);
if ($_POST['Insurance'] != '') {
$sql = "INSERT INTO custbranch (branchcode,\n\t\t\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\t\t\tbrname,\n\t\t\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\t\t\tsalesman,\n\t\t\t\t\t\t\t\t\t\t\tphoneno,\n\t\t\t\t\t\t\t\t\t\t\tdefaultlocation,\n\t\t\t\t\t\t\t\t\t\t\ttaxgroupid)\n\t\t\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['Insurance'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['FileNumber'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['Insurance'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $SalesAreaRow['areacode'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $SalesManRow['salesmancode'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['Telephone'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['DefaultFactoryLocation'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'1'\n\t\t\t\t\t\t\t\t\t\t)";
$result = DB_query($sql, $db);
}
prnMsg(_('The patient') . ' ' . $_POST['FileNumber'] . ' ' . _('has been successfully registered'), 'success');
}
}
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
示例5: prnMsg
echo '<P>';
prnMsg(_('The quantity entered must be numeric'), 'error');
$InputError = true;
} elseif ($_SESSION['Transfer']->TransferItem[0]->Quantity <= 0) {
echo '<P>';
prnMsg(_('The quantity entered must be a positive number greater than zero'), 'error');
$InputError = true;
}
if ($_SESSION['Transfer']->StockLocationFrom == $_SESSION['Transfer']->StockLocationTo) {
echo '<P>';
prnMsg(_('The locations to transfer from and to must be different'), 'error');
$InputError = true;
}
if ($InputError == False) {
/*All inputs must be sensible so make the stock movement records and update the locations stocks */
$TransferNumber = GetNextTransNo(16, $db);
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$SQLTransferDate = FormatDateForSQL(Date($_SESSION['DefaultDateFormat']));
$Result = DB_Txn_Begin($db);
// Need to get the current location quantity will need it later for the stock movement
$SQL = "SELECT locstock.quantity\n\t\t\tFROM locstock\n\t\t\tWHERE locstock.stockid='" . $_SESSION['Transfer']->TransferItem[0]->StockID . "'\n\t\t\tAND loccode= '" . $_SESSION['Transfer']->StockLocationFrom . "'";
$ErrMsg = _('Could not retrieve the QOH at the sending location because');
$DbgMsg = _('The SQL that failed was');
$Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
if (DB_num_rows($Result) == 1) {
$LocQtyRow = DB_fetch_row($Result);
$QtyOnHandPrior = $LocQtyRow[0];
} else {
// There must actually be some error this should never happen
$QtyOnHandPrior = 0;
}
示例6: exrate
exrate (1 EUR = (0.85 x 0.90)/0.52 USD)
(ExRate x FunctionalExRate) / USD Functional ExRate
functionalexrate = (1NZD = EUR 0.52)
*/
$ReceiptTransNo = GetNextTransNo(2, $db);
$SQL = "INSERT INTO banktrans (transno,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbankact,\n\t\t\t\t\t\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\t\t\t\t\t\texrate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tfunctionalexrate,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransdate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tbanktranstype,\n\t\t\t\t\t\t\t\t\t\t\t\t\tamount,\n\t\t\t\t\t\t\t\t\t\t\t\t\tcurrcode)\n\t\t\t\t\t\tVALUES ('" . $ReceiptTransNo . "',\n\t\t\t\t\t\t\t2,\n\t\t\t\t\t\t\t'" . $PaymentItem->GLCode . "',\n\t\t\t\t\t\t\t'" . _('Act Transfer From ') . $_SESSION['PaymentDetail' . $identifier]->Account . ' - ' . $PaymentItem->Narrative . "',\n\t\t\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->ExRate * $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate / $TrfToBankExRate . "',\n\t\t\t\t\t\t\t'" . $TrfToBankExRate . "',\n\t\t\t\t\t\t\t'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',\n\t\t\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "',\n\t\t\t\t\t\t\t'" . $PaymentItem->Amount . "',\n\t\t\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'\n\t\t\t\t\t\t)";
$ErrMsg = _('Cannot insert a bank transaction because');
$DbgMsg = _('Cannot insert a bank transaction with the SQL');
$result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
}
}
} else {
/*Its a supplier payment type 22 */
$CreditorTotal = ($_SESSION['PaymentDetail' . $identifier]->Discount + $_SESSION['PaymentDetail' . $identifier]->Amount) / $_SESSION['PaymentDetail' . $identifier]->ExRate / $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate;
$TransNo = GetNextTransNo(22, $db);
$TransType = 22;
/* Create a SuppTrans entry for the supplier payment */
$SQL = "INSERT INTO supptrans (transno,\n\t\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\t\tsupplierno,\n\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\tinputdate,\n\t\t\t\t\t\t\t\t\t\t\tsuppreference,\n\t\t\t\t\t\t\t\t\t\t\trate,\n\t\t\t\t\t\t\t\t\t\t\tovamount,\n\t\t\t\t\t\t\t\t\t\t\ttranstext) ";
$SQL = $SQL . "valueS ('" . $TransNo . "',\n\t\t\t\t\t22,\n\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "',\n\t\t\t\t\t'" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',\n\t\t\t\t\t'" . date('Y-m-d H-i-s') . "',\n\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->Paymenttype . "',\n\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->FunctionalExRate / $_SESSION['PaymentDetail' . $identifier]->ExRate . "',\n\t\t\t\t\t'" . (-$_SESSION['PaymentDetail' . $identifier]->Amount - $_SESSION['PaymentDetail' . $identifier]->Discount) . "',\n\t\t\t\t\t'" . $_SESSION['PaymentDetail' . $identifier]->Narrative . "'\n\t\t\t\t)";
$ErrMsg = _('Cannot insert a payment transaction against the supplier because');
$DbgMsg = _('Cannot insert a payment transaction against the supplier using the SQL');
$result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
/*Update the supplier master with the date and amount of the last payment made */
$SQL = "UPDATE suppliers\n\t\t\t\t\tSET\tlastpaiddate = '" . FormatDateForSQL($_SESSION['PaymentDetail' . $identifier]->DatePaid) . "',\n\t\t\t\t\t\tlastpaid='" . $_SESSION['PaymentDetail' . $identifier]->Amount . "'\n\t\t\t\t\tWHERE suppliers.supplierid='" . $_SESSION['PaymentDetail' . $identifier]->SupplierID . "'";
$ErrMsg = _('Cannot update the supplier record for the date of the last payment made because');
$DbgMsg = _('Cannot update the supplier record for the date of the last payment made using the SQL');
$result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
$_SESSION['PaymentDetail' . $identifier]->Narrative = $_SESSION['PaymentDetail' . $identifier]->SupplierID . '-' . $_SESSION['PaymentDetail' . $identifier]->Narrative;
if ($_SESSION['CompanyRecord']['gllink_creditors'] == 1) {
/* then do the supplier control GLTrans */
示例7: gltrans
}
/* end of the costing specific updates */
if ($_SESSION['CompanyRecord']['gllink_stock'] == 1) {
/*we always need to reverse entries relating to the GRN suspense during delivery and entry of shipment charges */
$sql = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\tamount)\n\t\t\t\tVALUES (31,\n\t\t\t\t\t" . $_GET['SelectedShipment'] . ",\n\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t" . $PeriodNo . ",\n\t\t\t\t\t" . $_SESSION['CompanyRecord']['grnact'] . ",\n\t\t\t\t\t'" . $myrow['itemcode'] . ' ' . _('shipt cost') . ' ' . number_format($ItemShipmentCost, 2) . ' x ' . _('Qty invoiced') . ' ' . $myrow['totqtyinvoiced'] . "',\n " . $Variance * $myrow['totqtyinvoiced'] . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The credit GL entry for the shipment variance posting for') . ' ' . $myrow['itemcode'] . ' ' . _('could not be inserted because');
$result = DB_query($sql, $db, $ErrMsg, '', TRUE);
}
if ($_POST['UpdateCost'] == 'Yes') {
/*Only ever a standard costing option
Weighted average costing implies cost updates taking place automatically */
$QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid ='" . $myrow['itemcode'] . "'", $db);
$QOHRow = DB_fetch_row($QOHResult);
$QOH = $QOHRow[0];
if ($_SESSION['CompanyRecord']['gllink_stock'] == 1) {
$CostUpdateNo = GetNextTransNo(35, $db);
$PeriodNo = GetPeriod(Date("d/m/Y"), $db);
$ValueOfChange = $QOH * ($ItemShipmentCost - $StdCostUnit);
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\tVALUES (35,\n\t\t\t\t\t\t\t" . $CostUpdateNo . ",\n\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t" . $PeriodNo . ",\n\t\t\t\t\t\t\t" . $StockGLCodes['adjglact'] . ",\n\t\t\t\t\t\t\t'" . _('Shipment of') . ' ' . $myrow['itemcode'] . " " . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . number_format($ItemShipmentCost, 2) . ' x ' . _('QOH of') . ' ' . $QOH . "', " . -$ValueOfChange . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL credit for the shipment stock cost adjustment posting could not be inserted because') . ' ' . DB_error_msg($db);
$Result = DB_query($SQL, $db, $ErrMsg, '', TRUE);
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\tVALUES (35,\n\t\t\t\t\t\t\t" . $CostUpdateNo . ",\n\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t" . $PeriodNo . ",\n\t\t\t\t\t\t\t" . $StockGLCodes['stockact'] . ",\n\t\t\t\t\t\t\t'" . _('Shipment of') . ' ' . $myrow['itemcode'] . ' ' . _('cost was') . ' ' . $StdCostUnit . ' ' . _('changed to') . ' ' . number_format($ItemShipmentCost, 2) . ' x ' . _('QOH of') . ' ' . $QOH . "',\n " . $ValueOfChange . ")";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GL debit for stock cost adjustment posting could not be inserted because') . ' ' . DB_error_msg($db);
$Result = DB_query($SQL, $db, $ErrMsg, '', TRUE);
}
/*end of GL entries for a standard cost update */
/* Only the material cost is important for imported items */
$sql = "UPDATE stockmaster SET materialcost=" . $ItemShipmentCost . ",\n\t\t\t\t\t\t\t\tlabourcost=0,\n\t\t\t\t\t\t\t\toverheadcost=0,\n\t\t\t\t\t\t\t\tlastcost=" . $StdCostUnit . "\n\t\t\t\t\t\tWHERE stockid='" . $myrow['itemcode'] . "'";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The shipment cost details for the stock item could not be updated because') . ': ' . DB_error_msg($db);
$result = DB_query($sql, $db, $ErrMsg, '', TRUE);
}
示例8: Round
$DemandDate = $DemRow[2];
}
if ($StockQOH < 0) {
$StockQOH = 0;
}
if ($StockQOH + $StockQOWO - $StockDemand < 0) {
$DemandQuantity = $StockDemand - ($StockQOH + $StockQOWO);
if ($StockEOQ > 0) {
if ($StockEOQ > $DemandQuantity) {
$DemandQuantity = $StockEOQ;
} else {
$EOQMultiple = Round($DemandQuantity / $StockEOQ + 0.49, 0);
$DemandQuantity = $StockEOQ * $EOQMultiple;
}
}
$WO = GetNextTransNo(30, $db);
// echo $WO. "= WO<BR>";
$InsWOResult = DB_query("INSERT INTO workorders (wo,\n loccode,\n requiredby,\n startdate)\n VALUES (" . $WO . ",\n '" . $_SESSION['UserStockLocation'] . "',\n '" . $DemandDate . "',\n '" . Date('Y-m-d') . "')", $db);
$sql = "INSERT INTO woitems (wo,\n\t stockid,\n\t qtyreqd,\n\t stdcost)\n\t VALUES ( " . $WO . ",\n '" . $StockId . "',\n " . $DemandQuantity . ",\n 0)";
$result = DB_query($sql, $db, $ErrMsg);
$sql2 = "INSERT INTO worequirements (wo,\n parentstockid,\n stockid,\n qtypu,\n stdcost,\n autoissue)\n \t SELECT " . $WO . ",\n \t bom.parent,\n bom.component,\n bom.quantity,\n (materialcost+labourcost+overheadcost)*bom.quantity,\n autoissue\n FROM bom INNER JOIN stockmaster\n ON bom.component=stockmaster.stockid\n WHERE parent='" . $StockId . "'\n AND loccode ='" . $_POST['StockLocation'] . "'";
$result = DB_query($sql2, $db, $ErrMsg);
echo '<tr><TD>' . $StockId . '</TD>';
echo '<td>' . $WO . '</td>';
echo '<TD>' . $StockDescription . '</td>';
echo '<td class="label">' . $DemandQuantity . '</td>';
$PictureToDisplay = '/srv/www/htdocs/batavg/webERP2/companies/' . $_SESSION['DatabaseName'] . '/part_pics/' . $StockId . '.jpg';
if (file_exists($PictureToDisplay)) {
echo '<td class="label">OK</td>';
} else {
echo '<td class="label">Need Picture</td>';
示例9: _
$DbgMsg = _('The SQL that was used to create the stock cost journal and failed was');
$result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\tVALUES ( 0,\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $JournalNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . GetPeriod(Date($_SESSION['DefaultDateFormat']), $db, true) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $OldStockAccount . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $StockID . ' ' . _('Change stock category') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . -$UnitCost * $StockQtyRow[0] . "')";
$result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
}
/* end if the stock category changed and forced a change in stock cost account */
if ($OldWIPAccount != $NewWIPAct and $_SESSION['CompanyRecord']['gllink_stock'] == 1) {
/*Then we need to make a journal to transfer the cost of WIP to the new WIP account */
/*First get the total cost of WIP for this category */
$WOCostsResult = DB_query("SELECT workorders.costissued,\n\t\t\t\t\t\t\t\t\t\t\t\t\tSUM(woitems.qtyreqd * woitems.stdcost) AS costrecd\n\t\t\t\t\t\t\t\t\t\t\t\tFROM woitems INNER JOIN workorders\n\t\t\t\t\t\t\t\t\t\t\t\tON woitems.wo = workorders.wo\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN stockmaster\n\t\t\t\t\t\t\t\t\t\t\t\tON woitems.stockid=stockmaster.stockid\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE stockmaster.stockid='" . $StockID . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND workorders.closed=0\n\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY workorders.costissued", _('Error retrieving value of finished goods received and cost issued against work orders for this item'));
$WIPValue = 0;
while ($WIPRow = DB_fetch_array($WOCostsResult)) {
$WIPValue += $WIPRow['costissued'] - $WIPRow['costrecd'];
}
if ($WIPValue != 0) {
$JournalNo = GetNextTransNo(0, $db);
//enter as a journal
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t\tVALUES ( 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $JournalNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . GetPeriod(Date($_SESSION['DefaultDateFormat']), $db, true) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $NewWIPAct . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $StockID . ' ' . _('Change stock category') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $WIPValue . "')";
$ErrMsg = _('The WIP cost journal could not be inserted because');
$DbgMsg = _('The SQL that was used to create the WIP cost journal and failed was');
$result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\t\t\tVALUES ( 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $JournalNo . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . GetPeriod(Date($_SESSION['DefaultDateFormat']), $db, true) . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $OldWIPAccount . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $StockID . ' ' . _('Change stock category') . "',\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . -$WIPValue . "')";
$result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
}
}
/* end if the stock category changed and forced a change in WIP account */
DB_Txn_Commit();
prnMsg(_('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success');
echo '<br />';
}
} else {
示例10: filter_number_format
$_POST['BankStatementBalance'] = filter_number_format($_POST['BankStatementBalance']);
}
if (isset($_POST['PostExchangeDifference']) and is_numeric(filter_number_format($_POST['DoExchangeDifference']))) {
if (!is_numeric($_POST['BankStatementBalance'])) {
prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'), 'warn');
echo '<br />' . $_POST['BankStatementBalance'];
} else {
/* Now need to get the currency of the account and the current table ex rate */
$SQL = "SELECT rate,\n\t\t\t\t\t\tbankaccountname,\n\t\t\t\t\t\tdecimalplaces AS currdecimalplaces\n\t\t\t\tFROM bankaccounts\n\t\t\t\tINNER JOIN currencies\n\t\t\t\t\tON bankaccounts.currcode=currencies.currabrev\n\t\t\t\tWHERE bankaccounts.accountcode = '" . $_POST['BankAccount'] . "'";
$ErrMsg = _('Could not retrieve the exchange rate for the selected bank account');
$CurrencyResult = DB_query($SQL, $db);
$CurrencyRow = DB_fetch_array($CurrencyResult);
$CalculatedBalance = filter_number_format($_POST['DoExchangeDifference']);
$ExchangeDifference = ($CalculatedBalance - filter_number_format($_POST['BankStatementBalance'])) / $CurrencyRow['rate'];
include 'includes/SQL_CommonFunctions.inc';
$ExDiffTransNo = GetNextTransNo(36, $db);
/*Post the exchange difference to the last day of the month prior to current date*/
$PostingDate = Date($_SESSION['DefaultDateFormat'], mktime(0, 0, 0, Date('m'), 0, Date('Y')));
$PeriodNo = GetPeriod($PostingDate, $db);
$Result = DB_Txn_Begin($db);
//yet to code the journal
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t VALUES (36,\n\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CompanyRecord']['exchangediffact'] . "',\n\t\t\t\t\t\t\t\t\t'" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . " " . Date($_SESSION['DefaultDateFormat']) . "','" . $ExchangeDifference . "')";
$ErrMsg = _('Cannot insert a GL entry for the exchange difference because');
$DbgMsg = _('The SQL that failed to insert the exchange difference GL entry was');
$Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
$SQL = "INSERT INTO gltrans (type,\n\t\t\t\t\t\t\t\t\ttypeno,\n\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\tperiodno,\n\t\t\t\t\t\t\t\t\taccount,\n\t\t\t\t\t\t\t\t\tnarrative,\n\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t VALUES (36,\n\t\t\t\t\t\t\t\t\t'" . $ExDiffTransNo . "',\n\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($PostingDate) . "',\n\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t'" . $_POST['BankAccount'] . "',\n\t\t\t\t\t\t\t\t\t'" . $CurrencyRow['bankaccountname'] . ' ' . _('reconciliation on') . ' ' . Date($_SESSION['DefaultDateFormat']) . "',\n\t\t\t\t\t\t\t\t\t'" . -$ExchangeDifference . "')";
$Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
$Result = DB_Txn_Commit($db);
prnMsg(_('Exchange difference of') . ' ' . locale_number_format($ExchangeDifference, $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('has been posted'), 'success');
}
//end if the bank statement balance was numeric
示例11: _
if ($_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity != $myrow['quantity'] or $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv != $myrow['qtyinvoiced']) {
echo '<br>' . _('Orig order for') . ' ' . $myrow['orderlineno'] . ' ' . _('has a quantity of') . ' ' . $myrow['quantity'] . ' ' . _('and an invoiced qty of') . ' ' . $myrow['qtyinvoiced'] . ' ' . _('the session shows quantity of') . ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->Quantity . ' ' . _('and quantity invoice of') . ' ' . $_SESSION['Items']->LineItems[$myrow['orderlineno']]->QtyInv;
prnMsg(_('This order has been changed or invoiced since this delivery was started to be confirmed') . ' ' . _('Processing halted.') . ' ' . _('To enter and confirm this dispatch, it must be re-selected and re-read again to update the changes made by the other user'), 'error');
echo '<br>';
echo '<div class="centre"><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '">' . _('Select a sales order for confirming deliveries and invoicing') . '</a></div>';
unset($_SESSION['Items']->LineItems);
unset($_SESSION['Items']);
unset($_SESSION['ProcessingOrder']);
include 'includes/footer.inc';
exit;
}
}
/*loop through all line items of the order to ensure none have been invoiced since started looking at this order*/
DB_free_result($Result);
/*Now Get the next invoice number - function in SQL_CommonFunctions*/
$InvoiceNo = GetNextTransNo(10, $db);
$PeriodNo = GetPeriod($DefaultDispatchDate, $db);
/*Start an SQL transaction */
DB_Txn_Begin($db);
if ($DefaultShipVia != $_SESSION['Items']->ShipVia) {
$SQL = "UPDATE custbranch SET defaultshipvia ='" . $_SESSION['Items']->ShipVia . "' WHERE debtorno='" . $_SESSION['Items']->DebtorNo . "' AND branchcode='" . $_SESSION['Items']->Branch . "'";
$ErrMsg = _('Could not update the default shipping carrier for this branch because');
$DbgMsg = _('The SQL used to update the branch default carrier was');
$result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
}
$DefaultDispatchDate = FormatDateForSQL($DefaultDispatchDate);
/*Update order header for invoice charged on */
$SQL = "UPDATE salesorders SET comments = CONCAT(comments,' Inv ','" . $InvoiceNo . "') WHERE orderno= " . $_SESSION['ProcessingOrder'];
$ErrMsg = _('CRITICAL ERROR') . ' ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales order header could not be updated with the invoice number');
$DbgMsg = _('The following SQL to update the sales order was used');
$Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
示例12: GetNextTransNo
$AccountTo = $myrowAccExp['glaccount'];
$TagTo = $myrowAccExp['tag'];
}
//get typeno
$typeno = GetNextTransNo($type, $db);
//build narrative
$Narrative = _('PettyCash') . ' - ' . $myrow['tabcode'] . ' - ' . $myrow['codeexpense'] . ' - ' . DB_escape_string($myrow['notes']) . ' - ' . $myrow['receipt'];
//insert to gltrans
DB_Txn_Begin($db);
$sqlFrom = "INSERT INTO `gltrans` (`counterindex`,\n\t\t\t\t\t\t\t\t\t\t\t`type`,\n\t\t\t\t\t\t\t\t\t\t\t`typeno`,\n\t\t\t\t\t\t\t\t\t\t\t`chequeno`,\n\t\t\t\t\t\t\t\t\t\t\t`trandate`,\n\t\t\t\t\t\t\t\t\t\t\t`periodno`,\n\t\t\t\t\t\t\t\t\t\t\t`account`,\n\t\t\t\t\t\t\t\t\t\t\t`narrative`,\n\t\t\t\t\t\t\t\t\t\t\t`amount`,\n\t\t\t\t\t\t\t\t\t\t\t`posted`,\n\t\t\t\t\t\t\t\t\t\t\t`jobref`,\n\t\t\t\t\t\t\t\t\t\t\t`tag`)\n\t\t\t\t\t\t\t\t\tVALUES (NULL,\n\t\t\t\t\t\t\t\t\t\t\t'" . $type . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $typeno . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['date'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $AccountFrom . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $Narrative . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -$Amount . "',\n\t\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TagTo . "')";
$ResultFrom = DB_Query($sqlFrom, $db, '', '', true);
$sqlTo = "INSERT INTO `gltrans` (`counterindex`,\n\t\t\t\t\t\t\t\t\t\t`type`,\n\t\t\t\t\t\t\t\t\t\t`typeno`,\n\t\t\t\t\t\t\t\t\t\t`chequeno`,\n\t\t\t\t\t\t\t\t\t\t`trandate`,\n\t\t\t\t\t\t\t\t\t\t`periodno`,\n\t\t\t\t\t\t\t\t\t\t`account`,\n\t\t\t\t\t\t\t\t\t\t`narrative`,\n\t\t\t\t\t\t\t\t\t\t`amount`,\n\t\t\t\t\t\t\t\t\t\t`posted`,\n\t\t\t\t\t\t\t\t\t\t`jobref`,\n\t\t\t\t\t\t\t\t\t\t`tag`)\n\t\t\t\t\t\t\t\tVALUES (NULL,\n\t\t\t\t\t\t\t\t\t\t'" . $type . "',\n\t\t\t\t\t\t\t\t\t\t'" . $typeno . "',\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t'" . $myrow['date'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $AccountTo . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Narrative . "',\n\t\t\t\t\t\t\t\t\t\t'" . $Amount . "',\n\t\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t\t\t'" . $TagTo . "')";
$ResultTo = DB_Query($sqlTo, $db, '', '', true);
if ($myrow['codeexpense'] == 'ASSIGNCASH') {
// if it's a cash assignation we need to updated banktrans table as well.
$ReceiptTransNo = GetNextTransNo(2, $db);
$SQLBank = "INSERT INTO banktrans (transno,\n\t\t\t\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\t\t\t\tbankact,\n\t\t\t\t\t\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t\t\t\t\t\t\texrate,\n\t\t\t\t\t\t\t\t\t\t\t\tfunctionalexrate,\n\t\t\t\t\t\t\t\t\t\t\t\ttransdate,\n\t\t\t\t\t\t\t\t\t\t\t\tbanktranstype,\n\t\t\t\t\t\t\t\t\t\t\t\tamount,\n\t\t\t\t\t\t\t\t\t\t\t\tcurrcode)\n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $ReceiptTransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t\t\t'" . $AccountFrom . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $Narrative . "',\n\t\t\t\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['rate'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['date'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'Cash',\n\t\t\t\t\t\t\t\t\t\t\t'" . -$myrow['amount'] . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $myrow['currency'] . "'\n\t\t\t\t\t\t\t\t\t\t)";
$ErrMsg = _('Cannot insert a bank transaction because');
$DbgMsg = _('Cannot insert a bank transaction with the SQL');
$resultBank = DB_query($SQLBank, $db, $ErrMsg, $DbgMsg, true);
}
$sql = "UPDATE pcashdetails\n\t\t\t\t\tSET authorized = '" . Date('Y-m-d') . "',\n\t\t\t\t\tposted = 1\n\t\t\t\t\tWHERE counterindex = '" . $myrow['counterindex'] . "'";
$resultupdate = DB_query($sql, $db, '', '', true);
DB_Txn_Commit($db);
}
if ($k == 1) {
echo '<tr class="EvenTableRows">';
$k = 0;
} else {
echo '<tr class="OddTableRows">';
$k = 1;
示例13: elseif
$PageNumber = 1;
$line_height = 19;
$Xpos = $Left_Margin + 1;
//template
if ($_POST['template'] == 'simple') {
$template = 'simple';
} elseif ($_POST['template'] == 'standard') {
$template = 'standard';
} elseif ($_POST['template'] == 'full') {
$template = 'full';
} else {
$template = 'fullprices';
}
// Create Transfer Number
if (!isset($Trf_ID) and $_POST['ReportType'] == 'Batch') {
$Trf_ID = GetNextTransNo(16, $db);
}
// from location
$ErrMsg = _('Could not retrieve location name from the database');
$sqlfrom = "SELECT locationname FROM `locations` WHERE loccode='" . $_POST['FromLocation'] . "'";
$result = DB_query($sqlfrom, $db, $ErrMsg);
$Row = DB_fetch_row($result);
$FromLocation = $Row['0'];
// to location
$sqlto = "SELECT locationname,\n\t\t\t\t\tcashsalecustomer,\n\t\t\t\t\tcashsalebranch\n\t\t\t\tFROM `locations`\n\t\t\t\tWHERE loccode='" . $_POST['ToLocation'] . "'";
$resultto = DB_query($sqlto, $db, $ErrMsg);
$RowTo = DB_fetch_row($resultto);
$ToLocation = $RowTo['0'];
$ToCustomer = $RowTo['1'];
$ToBranch = $RowTo['2'];
if ($template == 'fullprices') {
示例14: _
First Get the area where the credit note is to from the branches table */
$SQL = "SELECT area\n\t\t \tFROM custbranch\n\t\t\tWHERE custbranch.debtorno ='" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "'\n\t\t\tAND custbranch.branchcode = '" . $_SESSION['CreditItems' . $identifier]->Branch . "'";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The area cannot be determined for this customer');
$DbgMsg = _('The following SQL to insert the customer credit note was used');
$Result = DB_query($SQL, $ErrMsg, $DbgMsg);
if ($myrow = DB_fetch_row($Result)) {
$Area = $myrow[0];
}
DB_free_result($Result);
if ($_SESSION['CompanyRecord']['gllink_stock'] == 1 and $_POST['CreditType'] == 'WriteOff' and (!isset($_POST['WriteOffGLCode']) or $_POST['WriteOffGLCode'] == '')) {
prnMsg(_('For credit notes created to write off the stock a general ledger account is required to be selected. Please select an account to write the cost of the stock off to then click on Process again'), 'error');
include 'includes/footer.inc';
exit;
}
/*Now Get the next credit note number - function in SQL_CommonFunctions*/
$CreditNo = GetNextTransNo(11, $db);
$SQLCreditDate = Date('Y-m-d');
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
/*Start an SQL transaction */
DB_Txn_Begin();
/*Now insert the Credit Note into the DebtorTrans table allocations will have to be done seperately*/
$SQL = "INSERT INTO debtortrans (transno,\n\t\t\t\t\t\t\t \t\ttype,\n\t\t\t\t\t\t\t\t\tdebtorno,\n\t\t\t\t\t\t\t\t\tbranchcode,\n\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\tinputdate,\n\t\t\t\t\t\t\t\t\tprd,\n\t\t\t\t\t\t\t\t\ttpe,\n\t\t\t\t\t\t\t\t\tovamount,\n\t\t\t\t\t\t\t\t\tovgst,\n\t\t\t\t\t\t\t\t\tovfreight,\n\t\t\t\t\t\t\t\t\trate,\n\t\t\t\t\t\t\t\t\tinvtext,\n\t\t\t\t\t\t\t\t\tsalesperson)\n\t\t\t\t\t\t\t\t VALUES ('" . $CreditNo . "',\n\t\t\t\t\t\t\t\t \t'11',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->DebtorNo . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->Branch . "',\n\t\t\t\t\t\t\t\t\t'" . $SQLCreditDate . "',\n\t\t\t\t\t\t\t\t\t'" . date('Y-m-d H-i-s') . "',\n\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->DefaultSalesType . "',\n\t\t\t\t\t\t\t\t\t'" . -$_SESSION['CreditItems' . $identifier]->total . "',\n\t\t\t\t\t\t\t\t\t'" . -$TaxTotal . "',\n\t\t\t\t\t\t\t\t \t'" . -$_SESSION['CreditItems' . $identifier]->FreightCost . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CurrencyRate'] . "',\n\t\t\t\t\t\t\t\t\t'" . $_POST['CreditText'] . "',\n\t\t\t\t\t\t\t\t\t'" . $_SESSION['CreditItems' . $identifier]->SalesPerson . "' )";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The customer credit note transaction could not be added to the database because');
$DbgMsg = _('The following SQL to insert the customer credit note was used');
$Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
$CreditTransID = DB_Last_Insert_ID($db, 'debtortrans', 'id');
/* Insert the tax totals for each tax authority where tax was charged on the invoice */
foreach ($TaxTotals as $TaxAuthID => $TaxAmount) {
$SQL = "INSERT INTO debtortranstaxes (debtortransid,\n\t\t\t\t\t\t\ttaxauthid,\n\t\t\t\t\t\t\ttaxamount)\n\t\t\t\tVALUES ('" . $CreditTransID . "',\n\t\t\t\t\t\t'" . $TaxAuthID . "',\n\t\t\t\t\t\t'" . -$TaxAmount / $_SESSION['CurrencyRate'] . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The debtor transaction taxes records could not be inserted because');
$DbgMsg = _('The following SQL to insert the debtor transaction taxes record was used');
示例15: LastDayOfMonth
//depn calc has been run previously
$AllowUserEnteredProcessDate = false;
$_POST['ProcessDate'] = LastDayOfMonth(DateAdd(ConvertSQLDate($LastDepnRun[0]), 'd', 28));
}
/* Get list of assets for journal */
$sql = "SELECT fixedassets.assetid,\n\t\t\tfixedassets.description,\n\t\t\tfixedassets.depntype,\n\t\t\tfixedassets.depnrate,\n\t\t\tfixedassets.datepurchased,\n\t\t\tfixedassetcategories.accumdepnact,\n\t\t\tfixedassetcategories.depnact,\n\t\t\tfixedassetcategories.categorydescription,\n\t\t\tSUM(CASE WHEN fixedassettrans.fixedassettranstype='cost' THEN fixedassettrans.amount ELSE 0 END) AS costtotal,\n\t\t\tSUM(CASE WHEN fixedassettrans.fixedassettranstype='depn' THEN fixedassettrans.amount ELSE 0 END) AS depnbfwd\n\t\tFROM fixedassets\n\t\tINNER JOIN fixedassetcategories\n\t\t\tON fixedassets.assetcategoryid=fixedassetcategories.categoryid\n\t\tINNER JOIN fixedassettrans\n\t\t\tON fixedassets.assetid=fixedassettrans.assetid\n\t\tWHERE fixedassettrans.transdate<='" . FormatDateForSQL($_POST['ProcessDate']) . "'\n\t\tGROUP BY fixedassets.assetid,\n\t\t\tfixedassets.description,\n\t\t\tfixedassets.depntype,\n\t\t\tfixedassets.depnrate,\n\t\t\tfixedassets.datepurchased,\n\t\t\tfixedassetcategories.accumdepnact,\n\t\t\tfixedassetcategories.depnact,\n\t\t\tfixedassetcategories.categorydescription\n\t\tORDER BY assetcategoryid, assetid";
$AssetsResult = DB_query($sql, $db);
$InputError = false;
//always hope for the best
if (Date1GreaterThanDate2($_POST['ProcessDate'], Date($_SESSION['DefaultDateFormat']))) {
prnMsg(_('No depreciation will be committed as the processing date is beyond the current date. The depreciation run can only be run for periods prior to today'), 'warn');
$InputError = true;
}
if (isset($_POST['CommitDepreciation']) and $InputError == false) {
$result = DB_Txn_Begin($db);
$TransNo = GetNextTransNo(44, $db);
$PeriodNo = GetPeriod($_POST['ProcessDate'], $db);
}
echo '<br /><table>';
$Heading = '<tr>
<th>' . _('Asset ID') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Date Purchased') . '</th>
<th>' . _('Cost') . '</th>
<th>' . _('Accum Depn') . '</th>
<th>' . _('B/fwd Book Value') . '</th>
<th>' . _('Depn Type') . '</th>
<th>' . _('Depn Rate') . '</th>
<th>' . _('New Depn') . '</th>
</tr>';
echo $Heading;