本文整理匯總了PHP中DateAdd函數的典型用法代碼示例。如果您正苦於以下問題:PHP DateAdd函數的具體用法?PHP DateAdd怎麽用?PHP DateAdd使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DateAdd函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unset
*/
$_SESSION['ExistingOrder' . $identifier] = 0;
unset($_SESSION['PO' . $identifier]);
/* initialise new class object */
$_SESSION['PO' . $identifier] = new PurchOrder();
/*
* and fill it with essential data
*/
$_SESSION['PO' . $identifier]->AllowPrintPO = 1;
/* Of course 'cos the order aint even started !!*/
$_SESSION['PO' . $identifier]->GLLink = $_SESSION['CompanyRecord']['gllink_stock'];
/* set the SupplierID we got */
$_SESSION['PO' . $identifier]->SupplierID = $_GET['SelectedSupplier'];
$_SESSION['RequireSupplierSelection'] = 0;
$_POST['Select'] = $_GET['SelectedSupplier'];
$_SESSION['PO' . $identifier]->DeliveryDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $_GET['LeadTime']);
$_SESSION['PO' . $identifier]->Initiator = $_SESSION['UserID'];
$_SESSION['PO' . $identifier]->StatusMessage = '';
/*
* the item (its item code) that should be purchased
*/
$Purch_Item = $_GET['StockID'];
}
if ((isset($_POST['EnterLines']) or isset($_POST['LookupDeliveryAddress']) or isset($_POST['SearchSuppliers'])) and isset($_POST['StkLocation'])) {
/*User hit the button to enter line items -
* ensure session variables updated then meta refresh to PO_Items.php*/
$_SESSION['PO' . $identifier]->Location = $_POST['StkLocation'];
$_SESSION['PO' . $identifier]->SupplierContact = $_POST['SupplierContact'];
$_SESSION['PO' . $identifier]->DelAdd1 = $_POST['DelAdd1'];
$_SESSION['PO' . $identifier]->DelAdd2 = $_POST['DelAdd2'];
$_SESSION['PO' . $identifier]->DelAdd3 = $_POST['DelAdd3'];
示例2: while
$LastPrice = 0;
while ($myrow = DB_fetch_array($MovtsResult)) {
if ($LastPrice != $myrow['price'] or $LastDiscount != $myrow['discountpercent']) {
/* consolidate price history for records with same price/discount */
if (isset($qty)) {
$DateRange = ConvertSQLDate($FromDate);
if ($FromDate != $ToDate) {
$DateRange .= ' - ' . ConvertSQLDate($ToDate);
}
$PriceHistory[] = array($DateRange, $qty, $LastPrice, $LastDiscount);
$k++;
if ($k > 9) {
break;
/* 10 price records is enough to display */
}
if ($myrow['trandate'] < FormatDateForSQL(DateAdd(date($_SESSION['DefaultDateFormat']), 'y', -1))) {
break;
/* stop displaying pirce history more than a year old once we have at least one to display */
}
}
$LastPrice = $myrow['price'];
$LastDiscount = $myrow['discountpercent'];
$ToDate = $myrow['trandate'];
$qty = 0;
}
$qty += $myrow['qty'];
$FromDate = $myrow['trandate'];
}
if (isset($qty)) {
$DateRange = ConvertSQLDate($FromDate);
if ($FromDate != $ToDate) {
示例3: DATE_ADD
AND DATE_ADD(recurringsalesorders.lastrecurrence, ' . INTERVAL('365/recurringsalesorders.frequency', 'DAY') . ') <= recurringsalesorders.stopdate';
$RecurrOrdersDueResult = DB_query($sql, $db, _('There was a problem retrieving the recurring sales order templates. The database reported:'));
if (DB_num_rows($RecurrOrdersDueResult) == 0) {
prnMsg(_('There are no recurring order templates that are due to have another recurring order created'), 'warn');
include 'includes/footer.inc';
exit;
}
echo '<BR>The number of recurring orders to process is : ' . DB_num_rows($RecurrOrdersDueResult);
while ($RecurrOrderRow = DB_fetch_array($RecurrOrdersDueResult)) {
$EmailText = '';
echo '<BR>' . _('Recurring order') . ' ' . $RecurrOrderRow['recurrorderno'] . ' ' . _('for') . ' ' . $RecurrOrderRow['debtorno'] . ' - ' . $RecurrOrderRow['branchcode'] . ' ' . _('is being processed');
$result = DB_Txn_Begin($db);
/*the last recurrence was the date of the last time the order recurred
the frequency is the number of times per annum that the order should recurr
so 365 / frequency gives the number of days between recurrences */
$DelDate = FormatDateforSQL(DateAdd(ConvertSQLDate($RecurrOrderRow['lastrecurrence']), 'd', 365 / $RecurrOrderRow['frequency']));
echo '<BR>Date calculated for the next recurrence was: ' . $DelDate;
$HeaderSQL = "INSERT INTO salesorders (\n\t\t\t\tdebtorno,\n\t\t\t\tbranchcode,\n\t\t\t\tcustomerref,\n\t\t\t\tcomments,\n\t\t\t\torddate,\n\t\t\t\tordertype,\n\t\t\t\tshipvia,\n\t\t\t\tdeliverto,\n\t\t\t\tdeladd1,\n\t\t\t\tdeladd2,\n\t\t\t\tdeladd3,\n\t\t\t\tdeladd4,\n\t\t\t\tdeladd5,\n\t\t\t\tdeladd6,\n\t\t\t\tcontactphone,\n\t\t\t\tcontactemail,\n\t\t\t\tfreightcost,\n\t\t\t\tfromstkloc,\n\t\t\t\tdeliverydate )\n\t\t\tVALUES (\n\t\t\t\t'" . $RecurrOrderRow['debtorno'] . "',\n\t\t\t\t'" . $RecurrOrderRow['branchcode'] . "',\n\t\t\t\t'" . $RecurrOrderRow['customerref'] . "',\n\t\t\t\t'" . $RecurrOrderRow['comments'] . "',\n\t\t\t\t'" . $DelDate . "',\n\t\t\t\t'" . $RecurrOrderRow['ordertype'] . "',\n\t\t\t\t" . $RecurrOrderRow['shipvia'] . ",\n\t\t\t\t'" . $RecurrOrderRow['deliverto'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd1'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd2'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd3'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd4'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd5'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd6'] . "',\n\t\t\t\t'" . $RecurrOrderRow['contactphone'] . "',\n\t\t\t\t'" . $RecurrOrderRow['contactemail'] . "',\n\t\t\t\t" . $RecurrOrderRow['freightcost'] . ",\n\t\t\t\t'" . $RecurrOrderRow['fromstkloc'] . "',\n\t\t\t\t'" . $DelDate . "')";
$ErrMsg = _('The order cannot be added because');
$InsertQryResult = DB_query($HeaderSQL, $db, $ErrMsg, true);
$OrderNo = GetNextTransNo(30, $db);
$EmailText = _('A new order has been created from a recurring order template for customer') . ' ' . $RecurrOrderRow['debtorno'] . ' ' . $RecurrOrderRow['branchcode'] . "\n" . _('The order number is:') . ' ' . $OrderNo;
/*need to look up RecurringOrder from the template and populate the line RecurringOrder array with the sales order details records */
$LineItemsSQL = "SELECT recurrsalesorderdetails.stkcode,\n\t\t\t\trecurrsalesorderdetails.unitprice,\n\t\t\t\trecurrsalesorderdetails.quantity,\n\t\t\t\trecurrsalesorderdetails.discountpercent,\n\t\t\t\trecurrsalesorderdetails.narrative,\n\t\t\t\tstockmaster.taxcatid\n\t\t\tFROM recurrsalesorderdetails INNER JOIN stockmaster\n\t\t\t\tON recurrsalesorderdetails.stkcode = stockmaster.stockid\n\t\t\tWHERE recurrsalesorderdetails.recurrorderno =" . $RecurrOrderRow['recurrorderno'];
$ErrMsg = _('The line items of the recurring order cannot be retrieved because');
$LineItemsResult = db_query($LineItemsSQL, $db, $ErrMsg);
$LineCounter = 0;
if (db_num_rows($LineItemsResult) > 0) {
$OrderTotal = 0;
//intialise
$OrderLineTotal = 0;
示例4: elseif
#end if SearchResults to show
} elseif (isset($_POST['QuickEntry'])) {
/* show the quick entry form variable */
/*FORM VARIABLES TO POST TO THE ORDER WITH PART CODE AND QUANTITY */
echo '<div class="page_help_text"><b>' . _('Use this screen for the ') . _('Quick Entry') . _(' of products to be ordered') . '</b></div><br />
<table class="selection">
<tr>';
/*do not display colum unless customer requires po line number by sales order line*/
if ($_SESSION['Items' . $identifier]->DefaultPOLine == 1) {
echo '<th>' . _('PO Line') . '</th>';
}
echo '<th>' . _('Part Code') . '</th>
<th>' . _('Quantity') . '</th>
<th>' . _('Due Date') . '</th>
</tr>';
$DefaultDeliveryDate = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items' . $identifier]->DeliveryDays);
for ($i = 1; $i <= $_SESSION['QuickEntries']; $i++) {
echo '<tr class="OddTableRow">';
/* Do not display colum unless customer requires po line number by sales order line*/
if ($_SESSION['Items' . $identifier]->DefaultPOLine > 0) {
echo '<td><input type="text" name="poline_' . $i . '" size="21" maxlength="20" /></td>';
}
echo '<td><input type="text" name="part_' . $i . '" size="21" maxlength="20" /></td>
<td><input type="text" name="qty_' . $i . '" size="6" maxlength="6" /></td>
<td><input type="text" class="date" name="itemdue_' . $i . '" size="25" maxlength="25" alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . $DefaultDeliveryDate . '" /></td></tr>';
}
echo '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.part_1);}</script>';
echo '</table><br /><div class="centre"><button type="submit" name="QuickEntry">' . _('Quick Entry') . '</button>
<button type="submit" name="PartSearch">' . _('Search Parts') . '</button></div>';
} elseif (isset($_POST['SelectAsset'])) {
echo '<div class="page_help_text"><b>' . _('Use this screen to select an asset to dispose of to this customer') . '</b></div><br />
示例5: _
echo '<tr><td colspan="2"><div class="centre"><button type="submit" name="submit">' . _('Select') . '</button></div></td></tr>';
echo '</table></form>';
}
if (isset($_POST['NewItem']) and !isset($_POST['Refresh'])) {
foreach ($_POST as $key => $value) {
if (mb_substr($key, 0, 7) == 'StockID') {
$Index = mb_substr($key, 7, mb_strlen($key) - 7);
$StockID = $value;
$Quantity = filter_number_input($_POST['Qty' . $Index]);
$Price = filter_currency_input($_POST['Price' . $Index]);
$UOM = $_POST['uom' . $Index];
if (isset($UOM) and $Quantity > 0) {
$sql = "SELECT description, decimalplaces FROM stockmaster WHERE stockid='" . $StockID . "'";
$result = DB_query($sql, $db);
$myrow = DB_fetch_array($result);
$_SESSION['offer' . $identifier]->add_to_offer($_SESSION['offer' . $identifier]->LinesOnOffer, $StockID, $Quantity, $myrow['description'], $Price, $UOM, $myrow['decimalplaces'], DateAdd(date($_SESSION['DefaultDateFormat']), 'm', 3));
unset($UOM);
}
}
}
}
if (isset($_POST['Refresh']) and !isset($_POST['NewItem'])) {
foreach ($_POST as $key => $value) {
if (mb_substr($key, 0, 7) == 'StockID') {
$Index = mb_substr($key, 7, mb_strlen($key) - 7);
$StockID = $value;
$Quantity = filter_number_input($_POST['Qty' . $Index]);
$Price = filter_currency_input($_POST['Price' . $Index]);
$ExpiryDate = $_POST['expirydate' . $Index];
}
if (isset($ExpiryDate)) {
示例6: _
}
//View number of days
echo '<tr>
<td>' . _('Number Of Days') . ' </td>
<td>:</td>
<td><input class="integer" tabindex="3" type="text" required="required" title="' . _('Enter the number of days to examine the sales for') . '" name="NumberOfDays" size="8" maxlength="8" value="30" /></td>
</tr>
</table>
<br />
<div class="centre">
<input tabindex="5" type="submit" name="Search" value="' . _('Search') . '" />
</div>
</form>';
} else {
// everything below here to view NumberOfNoSalesItems on selected location
$FromDate = FormatDateForSQL(DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', -filter_number_format($_POST['NumberOfDays'])));
if ($_POST['StockCat'] == 'All') {
$WhereStockCat = "";
} else {
$WhereStockCat = " AND stockmaster.categoryid = '" . $_POST['StockCat'] . "'";
}
if ($_POST['Location'][0] == 'All') {
$SQL = "SELECT \tstockmaster.stockid,\n\t\t\t\t\tstockmaster.description,\n\t\t\t\t\tstockmaster.units\n\t\t\t\tFROM \tstockmaster,locstock\n\t\t\t\tINNER JOIN locationusers ON locationusers.loccode=locstock.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\t\tWHERE \tstockmaster.stockid = locstock.stockid " . $WhereStockCat . "\n\t\t\t\t\tAND (locstock.quantity > 0)\n\t\t\t\t\tAND NOT EXISTS (\n\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\tFROM \tsalesorderdetails, salesorders\n\t\t\t\t\t\t\tINNER JOIN locationusers ON locationusers.loccode=salesorders.fromstkloc AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\t\t\t\t\tWHERE \tstockmaster.stockid = salesorderdetails.stkcode\n\t\t\t\t\t\t\t\t\tAND (salesorderdetails.orderno = salesorders.orderno)\n\t\t\t\t\t\t\t\t\tAND salesorderdetails.actualdispatchdate > '" . $FromDate . "')\n\t\t\t\t\tAND NOT EXISTS (\n\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\tFROM \tstockmoves\n\t\t\t\t\t\t\tINNER JOIN locationusers ON locationusers.loccode=stockmoves.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\t\t\t\t\tWHERE \tstockmoves.stockid = stockmaster.stockid\n\t\t\t\t\t\t\t\t\tAND stockmoves.trandate >= '" . $FromDate . "')\n\t\t\t\t\tAND EXISTS (\n\t\t\t\t\t\t\tSELECT *\n\t\t\t\t\t\t\tFROM \tstockmoves\n\t\t\t\t\t\t\tINNER JOIN locationusers ON locationusers.loccode=stockmoves.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' AND locationusers.canview=1\n\t\t\t\t\t\t\tWHERE \tstockmoves.stockid = stockmaster.stockid\n\t\t\t\t\t\t\t\t\tAND stockmoves.trandate < '" . $FromDate . "'\n\t\t\t\t\t\t\t\t\tAND stockmoves.qty >0)\n\t\t\t\tGROUP BY stockmaster.stockid\n\t\t\t\tORDER BY stockmaster.stockid";
} else {
$WhereLocation = '';
if (sizeof($_POST['Location']) == 1) {
$WhereLocation = " AND locstock.loccode ='" . $_POST['Location'][0] . "' ";
} else {
$WhereLocation = " AND locstock.loccode IN(";
$commactr = 0;
foreach ($_POST['Location'] as $key => $value) {
示例7: filter_number_format
$_POST['RoundingFactor'] = filter_number_format($_POST['RoundingFactor']);
if ($_POST['CostType'] != 'OtherPriceList') {
$RoundedPrice = round(($Cost * (1 + $IncrementPercentage) * $CurrencyRate + $_POST['RoundingFactor'] / 2) / $_POST['RoundingFactor']) * $_POST['RoundingFactor'];
if ($RoundedPrice <= 0) {
$RoundedPrice = $_POST['RoundingFactor'];
}
} else {
$RoundedPrice = round(($Cost * (1 + $IncrementPercentage) + $_POST['RoundingFactor'] / 2) / $_POST['RoundingFactor']) * $_POST['RoundingFactor'];
if ($RoundedPrice <= 0) {
$RoundedPrice = $_POST['RoundingFactor'];
}
}
if ($Cost > 0) {
$CurrentPriceResult = DB_query("SELECT price,\n\t\t\t\t\t\t\t\t\t\t\t \t\t startdate,\n\t\t\t\t\t\t\t\t\t\t\t\t\t enddate\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM prices\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE typeabbrev= '" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND debtorno =''\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND currabrev='" . $_POST['CurrCode'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND startdate <='" . Date('Y-m-d') . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND (enddate>='" . Date('Y-m-d') . "' OR enddate='0000-00-00')\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND stockid='" . $myrow['stockid'] . "'");
if (DB_num_rows($CurrentPriceResult) == 1) {
$DayPriorToNewPrice = DateAdd($_POST['PriceStartDate'], 'd', -1);
$CurrentPriceRow = DB_fetch_array($CurrentPriceResult);
$UpdateSQL = "UPDATE prices SET enddate='" . FormatDateForSQL($DayPriorToNewPrice) . "'\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE typeabbrev='" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND currabrev='" . $_POST['CurrCode'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND debtorno=''\n\t\t\t\t\t\t\t\t\t\t\t\tAND startdate ='" . $CurrentPriceRow['startdate'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND enddate ='" . $CurrentPriceRow['enddate'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tAND stockid='" . $myrow['stockid'] . "'";
$ErrMsg = _('Error updating prices for') . ' ' . $myrow['stockid'] . ' ' . _('because');
$result = DB_query($UpdateSQL, $ErrMsg);
}
$sql = "INSERT INTO prices (stockid,\n\t\t\t\t\t\t\t\t\t\t\t\ttypeabbrev,\n\t\t\t\t\t\t\t\t\t\t\t\tcurrabrev,\n\t\t\t\t\t\t\t\t\t\t\t\tstartdate,\n\t\t\t\t\t\t\t\t\t\t\t\tenddate,\n\t\t\t\t\t\t\t\t\t\t\t\tprice)\n\t\t\t\t\t\t\t\tVALUES ('" . $myrow['stockid'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['PriceList'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . $_POST['CurrCode'] . "',\n\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_POST['PriceStartDate']) . "',\n\t\t\t\t\t\t\t\t\t\t'" . $SQLEndDate . "',\n\t\t\t\t\t\t\t\t \t\t'" . filter_number_format($RoundedPrice) . "')";
$ErrMsg = _('Error inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('because');
$result = DB_query($sql, $ErrMsg);
prnMsg(_('Inserting new price for') . ' ' . $myrow['stockid'] . ' ' . _('to') . ' ' . $RoundedPrice, 'info');
}
// end if cost > 0
}
//end while loop around items in the category
}
}
示例8: locale_number_format
$pdf->addTextWrap(310, $YPos, 45, $FontSize, locale_number_format($weeklyavail[14], 0), 'right');
$pdf->addTextWrap(355, $YPos, 45, $FontSize, locale_number_format($weeklyavail[15], 0), 'right');
$pdf->addTextWrap(400, $YPos, 45, $FontSize, locale_number_format($weeklyavail[16], 0), 'right');
$pdf->addTextWrap(445, $YPos, 45, $FontSize, locale_number_format($weeklyavail[17], 0), 'right');
$pdf->addTextWrap(490, $YPos, 45, $FontSize, locale_number_format($weeklyavail[18], 0), 'right');
$YPos -= 2 * $line_height;
// Third Group of Weeks
$pdf->addTextWrap($Left_Margin + 40, $YPos, 45, $FontSize, DateAdd($today, 'w', 19), 'right');
$pdf->addTextWrap(130, $YPos, 45, $FontSize, DateAdd($today, 'w', 20), 'right');
$pdf->addTextWrap(175, $YPos, 45, $FontSize, DateAdd($today, 'w', 21), 'right');
$pdf->addTextWrap(220, $YPos, 45, $FontSize, DateAdd($today, 'w', 22), 'right');
$pdf->addTextWrap(265, $YPos, 45, $FontSize, DateAdd($today, 'w', 23), 'right');
$pdf->addTextWrap(310, $YPos, 45, $FontSize, DateAdd($today, 'w', 24), 'right');
$pdf->addTextWrap(355, $YPos, 45, $FontSize, DateAdd($today, 'w', 25), 'right');
$pdf->addTextWrap(400, $YPos, 45, $FontSize, DateAdd($today, 'w', 26), 'right');
$pdf->addTextWrap(445, $YPos, 45, $FontSize, DateAdd($today, 'w', 27), 'right');
$pdf->addTextWrap(490, $YPos, 45, $FontSize, "Future", 'right');
$YPos -= $line_height;
$pdf->addTextWrap($Left_Margin, $YPos, 40, $FontSize, _('Gross Reqts'));
$pdf->addTextWrap($Left_Margin + 40, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[19], 0), 'right');
$pdf->addTextWrap(130, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[20], 0), 'right');
$pdf->addTextWrap(175, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[21], 0), 'right');
$pdf->addTextWrap(220, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[22], 0), 'right');
$pdf->addTextWrap(265, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[23], 0), 'right');
$pdf->addTextWrap(310, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[24], 0), 'right');
$pdf->addTextWrap(355, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[25], 0), 'right');
$pdf->addTextWrap(400, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[26], 0), 'right');
$pdf->addTextWrap(445, $YPos, 45, $FontSize, locale_number_format($WeeklyReq[27], 0), 'right');
$pdf->addTextWrap(490, $YPos, 45, $FontSize, locale_number_format($FutureReq, 0), 'right');
$YPos -= $line_height;
$pdf->addTextWrap($Left_Margin, $YPos, 40, $FontSize, _('Open Order'));
示例9: DateAdd
// Chicken pox date
$cpox = DateAdd("m", 12, $dobdate);
// Rubella date
$rubella = DateAdd("m", 144, $dobdate);
// Hepatitis booster dates
$hepboost1 = DateAdd("m", 12, $dobdate);
$hepboost2 = DateAdd("m", 120, $dobdate);
// OPV booster dates
$opvboost1 = DateAdd("m", 18, $dobdate);
$opvboost2 = DateAdd("m", 54, $dobdate);
// Typhoid booster dates
//$typhboost=DateAdd("m", 36, $typh);
$typhboost = date("l, dS of F, Y", $typh);
$typhboost = "Every three years after {$typhboost}";
// DT booster date
$dtboost = DateAdd("m", 96, $dobdate);
// Format the dates in a presentable form
if ($today > $bcgdate) {
$bcgdate = date("l, dS of F, Y", $bcgdate);
$bcgdate = "<font color=#FF0000>within {$bcgdate}</font>";
} else {
$bcgdate = "within " . date("l, dS of F, Y", $bcgdate);
}
if ($today > $opv1) {
$opv1 = date("l, dS of F, Y", $opv1);
$opv1 = "<font color=#FF0000>{$opv1}</font>";
} else {
$opv1 = date("l, dS of F, Y", $opv1);
}
if ($today > $opv2) {
$opv2 = date("l, dS of F, Y", $opv2);
示例10: DB_free_result
echo '<option value="' . $myrow['code'] . '">' . $myrow['description'] . '</option>';
}
}
//end while loop
DB_free_result($result);
echo '</select></td>
</tr>
<tr>
<td>' . _('Contract Description') . ':</td>
<td><textarea name="ContractDescription" style="width:100%" required="required" title="' . _('A description of the contract is required') . '" minlength="5" rows="5" cols="40">' . $_SESSION['Contract' . $identifier]->ContractDescription . '</textarea></td>
</tr><tr>
<td>' . _('Drawing File') . ' .jpg' . ' ' . _('format only') . ':</td>
<td><input type="file" id="Drawing" name="Drawing" /></td>
</tr>';
if (!isset($_SESSION['Contract' . $identifier]->RequiredDate)) {
$_SESSION['Contract' . $identifier]->RequiredDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'm', 1);
}
echo '<tr>
<td>' . _('Required Date') . ':</td>
<td><input type="text" required="required" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="RequiredDate" size="11" value="' . $_SESSION['Contract' . $identifier]->RequiredDate . '" /></td>
</tr>';
echo '<tr>
<td>' . _('Customer Reference') . ':</td>
<td><input type="text" name="CustomerRef" required="required" title="' . _('Enter the reference that the customer uses for this contract') . '" size="21" maxlength="20" value="' . $_SESSION['Contract' . $identifier]->CustomerRef . '" /></td>
</tr>';
if (!isset($_SESSION['Contract' . $identifier]->Margin)) {
$_SESSION['Contract' . $identifier]->Margin = 50;
}
echo '<tr>
<td>' . _('Gross Profit') . ' %:</td>
<td><input class="number" type="text" name="Margin" required="required" size="6" maxlength="6" value="' . locale_number_format($_SESSION['Contract' . $identifier]->Margin, 2) . '" /></td>
示例11: _
} else {
$sql = "SELECT stockmaster.description,\n\t\t\t\t\t\t\t\tstockmaster.stockid,\n\t\t\t\t\t\t\t\tstockmaster.units,\n\t\t\t\t\t\t\t\tstockmaster.decimalplaces,\n\t\t\t\t\t\t\t\tstockmaster.kgs,\n\t\t\t\t\t\t\t\tstockmaster.netweight,\n\t\t\t\t\t\t\t\tstockcategory.stockact,\n\t\t\t\t\t\t\t\tchartmaster.accountname\n\t\t\t\t\t\t\tFROM stockcategory,\n\t\t\t\t\t\t\t\tchartmaster,\n\t\t\t\t\t\t\t\tstockmaster\n\t\t\t\t\t\t\tWHERE chartmaster.accountcode = stockcategory.stockact\n\t\t\t\t\t\t\t\tAND stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\t\tAND stockmaster.stockid = '" . $ItemCode . "'";
}
$ErrMsg = _('The supplier pricing details for') . ' ' . $ItemCode . ' ' . _('could not be retrieved because');
$DbgMsg = _('The SQL used to retrieve the pricing details but failed was');
$result1 = DB_query($sql, $db, $ErrMsg, $DbgMsg);
if ($myrow = DB_fetch_array($result1)) {
if (isset($myrow['price']) and is_numeric($myrow['price'])) {
if ($Quantity < $myrow['minorderqty']) {
prnMsg(_('The quantity ordered is less than the minimum order quantity for this supplier.') . '<br />' . _('Are you sure you wish to continue?'), 'warn');
} else {
if ($Quantity % $myrow['minorderqty']) {
prnMsg(_('The quantity ordered should be a multiple of the minimum order quantity for this supplier.') . '<br />' . _('Are you sure you wish to continue?'), 'warn');
}
}
$_SESSION['PO' . $identifier]->add_to_order($_SESSION['PO' . $identifier]->LinesOnOrder + 1, $ItemCode, 0, 0, $Quantity, $myrow['description'], $myrow['price'], $myrow['unitname'], $myrow['stockact'], DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $myrow['leadtime']), 0, 0, 0, 0, 0, $myrow['accountname'], $myrow['decimalplaces'], $ItemCode, $myrow['unitname'], $myrow['conversionfactor'], $myrow['leadtime'], $myrow['suppliers_partno'], $Quantity * $myrow['price'], '', 0, $myrow['netweight'], $myrow['kgs'], '', $Quantity, $Quantity * $myrow['price']);
} else {
/*There was no supplier purchasing data for the item selected so enter a purchase order line with zero price */
$_SESSION['PO' . $identifier]->add_to_order($_SESSION['PO' . $identifier]->LinesOnOrder + 1, $ItemCode, 0, 0, $Quantity, $myrow['description'], 0, $myrow['units'], $myrow['stockact'], $_SESSION['PO' . $identifier]->DeliveryDate, 0, 0, 0, 0, 0, $myrow['accountname'], $myrow['decimalplaces'], $ItemCode, $myrow['units'], 1, 1, '', 0, 0, '', 0, 0, 0, 0, 0, 0);
}
/*Make sure the line is also available for editing by default without additional clicks */
// $_GET['Edit'] = $_SESSION['PO'.$identifier]->LinesOnOrder; /* this is a bit confusing but it was incremented by the add_to_order function */
} else {
prnMsg(_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'), 'error');
if ($debug == 1) {
echo '<br />' . $sql;
}
include 'includes/footer.inc';
exit;
}
}
示例12: DB_query
$PeriodAllocated--;
//decrement the period
if ($PeriodNo - $PeriodAllocated > 6) {
/*if more than 6 months ago when sales were made then forget it */
break;
}
//$PeriodNo - $PeriodAllocated > 6
}
//$QuantityVarianceAllocated > 0
/*end loop around different periods to see which sales analysis records to update */
/*now we need to work back through the sales stockmoves up to the quantity on this purchase invoice to update costs
* Only go back up to 6 months looking for stockmoves and
* Only in the stock location where the purchase order was received
* into - if the stock was transferred to another location then
* we cannot adjust for this */
$result = DB_query("SELECT stkmoveno,\n\t\t\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\t\t\tqty,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstandardcost\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM stockmoves\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE loccode='" . $LocCode . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND qty < 0\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND stockid='" . $EnteredGRN->ItemCode . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND trandate>='" . FormatDateForSQL(DateAdd($_SESSION['SuppTrans']->TranDate, 'm', -6)) . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY stkmoveno DESC", $db);
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movements for invoices cannot be updated for the cost variances on this purchase invoice');
$QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv;
while ($StkMoveRow = DB_fetch_array($result) and $QuantityVarianceAllocated > 0) {
if ($StkMoveRow['qty'] + $QuantityVarianceAllocated > 0) {
if ($StkMoveRow['type'] == 10) {
//its a sales invoice
$result = DB_query("UPDATE stockmoves\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET standardcost = '" . $ActualCost . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE stkmoveno = '" . $StkMoveRow['stkmoveno'] . "'", $db, $ErrMsg, $DbgMsg, True);
}
//$StkMoveRow['type'] == 10
} else {
//Only $QuantityVarianceAllocated left to allocate so need need to apportion cost using weighted average
if ($StkMoveRow['type'] == 10) {
//its a sales invoice
$WACost = ((-$StkMoveRow['qty'] - $QuantityVarianceAllocated) * $StkMoveRow['standardcost'] + $QuantityVarianceAllocated * $ActualCost) / -$StkMoveRow['qty'];
$UpdStkMovesResult = DB_query("UPDATE stockmoves\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSET standardcost = '" . $WACost . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE stkmoveno = '" . $StkMoveRow['stkmoveno'] . "'", $db, $ErrMsg, $DbgMsg, True);
示例13: MonthAndYearFromSQLDate
if ($_POST['FromPeriod'] == $myrow['periodno']) {
echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
} else {
echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
}
} else {
if ($myrow['lastdate_in_period'] == $DefaultFromDate) {
echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
} else {
echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
}
}
}
echo '</select></td></tr>';
if (!isset($_POST['ToPeriod']) or $_POST['ToPeriod'] == '') {
$DefaultToPeriod = GetPeriod(DateAdd(ConvertSQLDate($DefaultFromDate), 'm', 11), $db);
} else {
$DefaultToPeriod = $_POST['ToPeriod'];
}
echo '<tr>
<td>' . _('Select Period To:') . '</td>
<td><select minlength="0" name="ToPeriod">';
$RetResult = DB_data_seek($Periods, 0);
while ($myrow = DB_fetch_array($Periods, $db)) {
if ($myrow['periodno'] == $DefaultToPeriod) {
echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
} else {
echo '<option value ="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
}
}
echo '</select></td></tr>';
示例14: initPopup
public function initPopup($item, $data)
{
if (!empty($data['editType'])) {
$this->_edit_type = $data['editType'];
$this->_popup_controller->assign('item', 'edit_type', $data['editType']);
}
// assign template vars
$this->assignTemplateVars();
$current_context = $this->_environment->getCurrentContextItem();
if ($item !== null) {
// edit mode
// TODO: check rights
// files
$attachment_infos = array();
$converter = $this->_environment->getTextConverter();
$file_list = $item->getFileList();
$file = $file_list->getFirst();
while ($file) {
#$info['file_name'] = $converter->text_as_html_short($file->getDisplayName());
$info['file_name'] = $converter->filenameFormatting($file->getDisplayName());
$info['file_icon'] = $file->getFileIcon();
$info['file_id'] = $file->getFileID();
$attachment_infos[] = $info;
$file = $file_list->getNext();
}
$this->_popup_controller->assign('item', 'files', $attachment_infos);
$this->_popup_controller->assign('item', 'title', $item->getTitle());
// old formating
$c_old_text_formating_array = $this->_environment->getConfiguration('c_old_text_formating_array');
if (!empty($c_old_text_formating_array) and is_array($c_old_text_formating_array) and in_array($this->_environment->getCurrentContextID(), $c_old_text_formating_array)) {
$this->_with_old_text_formating = true;
}
if ($this->_with_old_text_formating) {
$desc_string = $item->getDescription();
$desc_string = preg_replace('/(?:[ \\t]*(?:\\n|\\r\\n?)){2,}/', "\n", $desc_string);
$desc_string = nl2br($desc_string);
$desc_string = str_replace('<br /><br />', '<br />', $desc_string);
$this->_popup_controller->assign('item', 'description', $desc_string);
} else {
$this->_popup_controller->assign('item', 'description', $item->getDescription());
}
$this->_popup_controller->assign('item', 'public', $item->isPublic());
if ($item->getSeconddateTime() != '') {
$this->_popup_controller->assign('item', 'dayEnd', mb_substr($item->getSeconddateTime(), 0, 10));
$this->_popup_controller->assign('item', 'timeEnd', getTimeInLang($item->getSeconddateTime()));
} else {
$time = $current_context->getTimeSpread();
$this->_popup_controller->assign('item', 'dayEnd', DateAdd($time, date("Y-m-d"), "Y-m-d"));
$this->_popup_controller->assign('item', 'timeEnd', date("H:m"));
}
$activating = false;
if ($current_context->withActivatingContent()) {
$activating = true;
$this->_popup_controller->assign('item', 'private_editing', $item->isPrivateEditing());
if ($item->isNotActivated()) {
$this->_popup_controller->assign('item', 'is_not_activated', true);
$activating_date = $item->getActivatingDate();
if (!stristr($activating_date, '9999')) {
$this->_popup_controller->assign('item', 'activating_date', mb_substr($activating_date, 0, 10));
$this->_popup_controller->assign('item', 'activating_time', mb_substr($activating_date, -8));
}
}
}
$this->_popup_controller->assign('popup', 'activating', $activating);
} else {
$time = $current_context->getTimeSpread();
$this->_popup_controller->assign('item', 'dayEnd', DateAdd($time, date("Y-m-d"), "Y-m-d"));
$this->_popup_controller->assign('item', 'timeEnd', date("H:m"));
if ($current_context->isCommunityRoom()) {
$this->_popup_controller->assign('item', 'public', '1');
} else {
$this->_popup_controller->assign('item', 'public', '0');
}
}
}
示例15: LevelNetting
//.........這裏部分代碼省略.........
$Requirements[$reqi]['quantity'] = 0;
$reqi++;
if ($RequirementCount > $reqi) {
$TotalRequirement += $Requirements[$reqi]['quantity'];
}
$TotalRequirement -= $TotalSupply;
$Requirements[$reqi]['quantity'] -= $TotalSupply;
$TotalSupply = 0;
$Supplies[$supi]['supplyquantity'] = 0;
$supi++;
if ($SupplyCount > $supi) {
$TotalSupply += $Supplies[$supi]['supplyquantity'];
}
}
// End of if $TotalRequirement > $TotalSupply
}
// End of while
}
// End of if
// When get to this part of code, have gone through all requirements, If there is any
// unmet requirements, create an mrpplannedorder to cover it. Also call the
// CreateLowerLevelRequirement() function to create gross requirements for lower level parts.
// There is an excess quantity if the eoq is higher than the actual required amount.
// If there is a subsuquent requirement, the excess quantity is subtracted from that
// quantity. For instance, if the first requirement was for 2 and the eoq was 5, there
// would be an excess of 3; if there was another requirement for 3 or less, the excess
// would cover it, so no planned order would have to be created for the second requirement.
$ExcessQty = 0;
foreach ($Requirements as $key => $row) {
$DateRequired[$key] = $row['daterequired'];
}
if (count($Requirements)) {
array_multisort($DateRequired, SORT_ASC, $Requirements);
}
foreach ($Requirements as $Requirement) {
// First, inflate requirement if there is a shrinkage factor
// Should the quantity be rounded?
if ($_POST['ShrinkageFlag'] == 'y' and $ShrinkFactor > 0) {
$Requirement['quantity'] = $Requirement['quantity'] * 100 / (100 - $ShrinkFactor);
$Requirement['quantity'] = round($Requirement['quantity'], $DecimalPlaces);
}
if ($ExcessQty >= $Requirement['quantity']) {
$PlannedQty = 0;
$ExcessQty -= $Requirement['quantity'];
} else {
$PlannedQty = $Requirement['quantity'] - $ExcessQty;
$ExcessQty = 0;
}
if ($PlannedQty > 0) {
if ($_POST['EOQFlag'] == 'y' and $eoq > $PlannedQty) {
$ExcessQty = $eoq - $PlannedQty;
$PlannedQty = $eoq;
}
// Pansize calculation here
// if $PlannedQty not evenly divisible by $PanSize, calculate as $PlannedQty
// divided by $PanSize and rounded up to the next highest integer and then
// multiplied by the pansize. For instance, with a planned qty of 17 with a pansize
// of 5, divide 17 by 5 to get 3 with a remainder of 2, which is rounded up to 4
// and then multiplied by 5 - the pansize - to get 20
if ($_POST['PanSizeFlag'] == 'y' and $PanSize != 0 and $PlannedQty != 0) {
$PlannedQty = ceil($PlannedQty / $PanSize) * $PanSize;
}
// Calculate required date by subtracting leadtime from top part's required date
$PartRequiredDate = $Requirement['daterequired'];
if ((int) $LeadTime > 0) {
$CalendarSQL = "SELECT COUNT(*),cal2.calendardate\n\t\t\t\t\t\t FROM mrpcalendar\n\t\t\t\t\t\t\tLEFT JOIN mrpcalendar as cal2\n\t\t\t\t\t\t\t ON (mrpcalendar.daynumber - '" . $LeadTime . "') = cal2.daynumber\n\t\t\t\t\t\t WHERE mrpcalendar.calendardate = '" . $PartRequiredDate . "'\n\t\t\t\t\t\t\tAND cal2.manufacturingflag='1'\n\t\t\t\t\t\t\tGROUP BY cal2.calendardate";
$ResultDate = DB_query($CalendarSQL, $db);
$myrowdate = DB_fetch_array($ResultDate);
$NewDate = $myrowdate[1];
// If can't find date based on manufacturing calendar, use $PartRequiredDate
} else {
// Convert $PartRequiredDate from mysql format to system date format, use that to subtract leadtime
// from it using DateAdd, convert that date back to mysql format
$ConvertDate = ConvertSQLDate($PartRequiredDate);
$DateAdd = DateAdd($ConvertDate, 'd', $LeadTime * -1);
$NewDate = FormatDateForSQL($DateAdd);
}
$sql = "INSERT INTO mrpplannedorders (id,\n\t\t\t\t\t\t\t\t\t\t\t\tpart,\n\t\t\t\t\t\t\t\t\t\t\t\tduedate,\n\t\t\t\t\t\t\t\t\t\t\t\tsupplyquantity,\n\t\t\t\t\t\t\t\t\t\t\t\tordertype,\n\t\t\t\t\t\t\t\t\t\t\t\torderno,\n\t\t\t\t\t\t\t\t\t\t\t\tmrpdate,\n\t\t\t\t\t\t\t\t\t\t\t\tupdateflag)\n\t\t\t\t\t\t\t\t\t\t\tVALUES (NULL,\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $Requirement['part'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $NewDate . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $PlannedQty . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $Requirement['mrpdemandtype'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $Requirement['orderno'] . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'" . $NewDate . "',\n\t\t\t\t\t\t\t\t\t\t\t\t'0')";
$result = DB_query($sql, $db);
// If part has lower level components, create requirements for them
$sql = "SELECT COUNT(*) FROM bom\n\t\t\t\t\t WHERE parent ='" . $Requirement['part'] . "'\n\t\t\t\t\t GROUP BY parent";
$result = DB_query($sql, $db);
$myrow = DB_fetch_row($result);
if ($myrow[0] > 0) {
CreateLowerLevelRequirement($db, $Requirement['part'], $Requirement['daterequired'], $PlannedQty, $Requirement['mrpdemandtype'], $Requirement['orderno'], $Requirement['whererequired']);
}
}
// End of if $PlannedQty > 0
}
// End of foreach $Requirements
// If there are any supplies not used and updateflag is zero, those supplies are not
// necessary, so change date
foreach ($Supplies as $supply) {
if ($supply['supplyquantity'] > 0 && $supply['updateflag'] == 0) {
$id = $supply['id'];
$sql = "UPDATE mrpsupplies SET mrpdate ='2050-12-31' WHERE id = '" . $id . "'\n\t\t\t\t\t AND ordertype <> 'QOH'";
$result = DB_query($sql, $db);
}
}
}