当前位置: 首页>>代码示例>>PHP>>正文


PHP Is_Date函数代码示例

本文整理汇总了PHP中Is_Date函数的典型用法代码示例。如果您正苦于以下问题:PHP Is_Date函数的具体用法?PHP Is_Date怎么用?PHP Is_Date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Is_Date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: VerifyFwdDate

function VerifyFwdDate($FwdDate, $i, $Errors)
{
    if (!Is_Date($FwdDate)) {
        $Errors[$i] = InvalidFwdDate;
    }
    return $Errors;
}
开发者ID:xuxudodo,项目名称:weberp-cvs,代码行数:7,代码来源:api_branches.php

示例2: filter_number_format

             $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * $_SESSION['SuppTrans']->OvAmount;
         }
     } else {
         /*Tax being entered manually accept the taxamount entered as is*/
         $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = filter_number_format($_POST['TaxAmount' . $Tax->TaxCalculationOrder]);
     }
     $TaxTotal += $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount;
 }
 $InputError = False;
 if ($TaxTotal + $_SESSION['SuppTrans']->OvAmount <= 0) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the total amount of the credit note is less than or equal to 0') . '. ' . _('Credit notes are expected to be entered as positive amounts to credit'), 'warn');
 } elseif (mb_strlen($_SESSION['SuppTrans']->SuppReference) < 1) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the there is no suppliers credit note number or reference entered') . '. ' . _('The supplier credit note number must be entered'), 'error');
 } elseif (!Is_Date($_SESSION['SuppTrans']->TranDate)) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
 } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the date is after today') . '. ' . _('Purchase credit notes are expected to have a date prior to or today'), 'error');
 } elseif ($_SESSION['SuppTrans']->ExRate <= 0) {
     $InputError = True;
     prnMsg(_('The credit note as entered cannot be processed because the exchange rate for the credit note has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'), 'warn');
 } elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalAssetValue + $TotalGRNValue, $_SESSION['SuppTrans']->CurrDecimalPlaces)) {
     prnMsg(_('The credit note total as entered is less than the sum of the shipment charges') . ', ' . _('the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere') . ', ' . _('the credit note as entered will not be processed'), 'error');
     $InputError = True;
 } else {
     /* SQL to process the postings for purchase credit note */
     /*Start an SQL transaction */
     DB_Txn_Begin($db);
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:SupplierCredit.php

示例3: prnMsg

 if (!Is_Date($_POST['StartDate'])) {
     $InputError = 1;
     prnMsg(_('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
 }
 if (!Is_Date($_POST['EndDate'])) {
     $InputError = 1;
     prnMsg(_('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
     if (Date1GreaterThanDate2($_POST['StartDate'], $_POST['EndDate'])) {
         $InputError = 1;
         prnMsg(_('The end date is expected to be after the start date, enter an end date after the start date for this price'), 'error');
     }
 }
 if (Is_Date($_POST['EndDate'])) {
     $SQLEndDate = FormatDateForSQL($_POST['EndDate']);
 }
 if (Is_Date($_POST['StartDate'])) {
     $SQLStartDate = FormatDateForSQL($_POST['StartDate']);
 }
 $sql = "SELECT COUNT(salestype)\r\n\t\t\t\tFROM pricematrix\r\n\t\t\tWHERE stockid='" . $StockID . "'\r\n\t\t\tAND startdate='" . $SQLStartDate . "'\r\n\t\t\tAND enddate='" . $SQLEndDate . "'\r\n\t\t        AND salestype='" . $_POST['TypeAbbrev'] . "'\r\n\t\t\tAND currabrev='" . $_POST['currabrev'] . "'\r\n\t\t\tAND quantitybreak='" . $_POST['quantitybreak'] . "'";
 $result = DB_query($sql);
 $myrow = DB_fetch_row($result);
 if ($myrow[0] != 0 and !isset($_POST['OldTypeAbbrev']) and !isset($_POST['OldCurrAbrev'])) {
     prnMsg(_('This price has already been entered. To change it you should edit it'), 'warn');
     $InputError = 1;
 }
 if (isset($_POST['OldTypeAbbrev']) and isset($_POST['OldCurrAbrev']) and mb_strlen($StockID) > 1 and $InputError != 1) {
     /* Update existing prices */
     $sql = "UPDATE pricematrix SET \r\n\t\t\t\t\tsalestype='" . $_POST['SalesType'] . "',\r\n\t\t\t\t\tcurrabrev='" . $_POST['CurrAbrev'] . "',\r\n\t\t\t\t\tprice='" . filter_number_format($_POST['Price']) . "',\r\n\t\t\t\t\tstartdate='" . $SQLStartDate . "',\r\n\t\t\t\t\tenddate='" . $SQLEndDate . "',\r\n\t\t\t\t\tquantitybreak='" . filter_number_format($_POST['QuantityBreak']) . "'\r\n\t\t\t\tWHERE stockid='" . $StockID . "'\r\n\t\t\t\tAND startdate='" . $_POST['OldStartDate'] . "'\r\n\t\t\t\tAND enddate='" . $_POST['OldEndDate'] . "'\r\n\t\t\t\tAND salestype='" . $_POST['OldTypeAbbrev'] . "'\r\n\t\t\t\tAND currabrev='" . $_POST['OldCurrAbrev'] . "'\r\n\t\t\t\tAND quantitybreak='" . filter_number_format($_POST['OldQuantityBreak']) . "'";
     $ErrMsg = _('Could not be update the existing prices');
     $result = DB_query($sql, $ErrMsg);
     ReSequenceEffectiveDates($StockID, $_POST['SalesType'], $_POST['CurrAbrev'], $_POST['QuantityBreak'], $db);
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:PriceMatrix.php

示例4: _

 $pdf->addInfo('Title', _('Price Listing Report'));
 $pdf->addInfo('Subject', _('Price List'));
 $PageNumber = 1;
 $line_height = 12;
 /*Now figure out the inventory data to report for the category range under review */
 if ($_POST['CustomerSpecials'] == _('Customer Special Prices Only')) {
     if ($_SESSION['CustomerID'] == '') {
         $title = _('Special price List - No Customer Selected');
         include 'includes/header.inc';
         echo '<br />';
         prnMsg(_('The customer must first be selected from the select customer link') . '. ' . _('Re-run the price list once the customer has been selected'));
         echo '<br /><br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Back') . '</a>';
         include 'includes/footer.inc';
         exit;
     }
     if (!Is_Date($_POST['EffectiveDate'])) {
         $title = _('Special price List - No Customer Selected');
         include 'includes/header.inc';
         prnMsg(_('The effective date must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
         echo '<br /><br /><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Back') . '</a>';
         include 'includes/footer.inc';
         exit;
     }
     $SQL = "SELECT debtorsmaster.name,\n\t\t\t\tdebtorsmaster.salestype\n\t\t\t\tFROM debtorsmaster\n\t\t\t\tWHERE debtorno = '" . $_SESSION['CustomerID'] . "'";
     $CustNameResult = DB_query($SQL, $db);
     $CustNameRow = DB_fetch_row($CustNameResult);
     $CustomerName = $CustNameRow[0];
     $SalesType = $CustNameRow[1];
     $SQL = "SELECT prices.typeabbrev,\n  \t\t\t\t\t\tprices.stockid,\n  \t\t\t\t\t\tstockmaster.description,\n  \t\t\t\t\t\tstockmaster.longdescription,\n  \t\t\t\t\t\tprices.currabrev,\n  \t\t\t\t\t\tprices.startdate,\n  \t\t\t\t\t\tprices.enddate,\n  \t\t\t\t\t\tprices.price,\n  \t\t\t\t\t\tstockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost,\n  \t\t\t\t\t\tstockmaster.categoryid,\n  \t\t\t\t\t\tstockcategory.categorydescription,\n  \t\t\t\t\t\tprices.debtorno,\n  \t\t\t\t\t\tprices.branchcode,\n  \t\t\t\t\t\tcustbranch.brname,\n  \t\t\t\t\t\tcurrencies.decimalplaces\n\t\t\t\t\t\tFROM stockmaster INNER JOIN\tstockcategory\n\t\t\t\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\t\t\t\tINNER JOIN prices\n\t\t\t\t\t\tON stockmaster.stockid=prices.stockid\n\t\t\t\t\t\tINNER JOIN currencies\n\t\t\t\t\t\tON prices.currabrev=currencies.currabrev\n                        LEFT JOIN custbranch\n\t\t\t\t\t\tON prices.debtorno=custbranch.debtorno\n\t\t\t\t\t\tAND prices.branchcode=custbranch.branchcode\n\t\t\t\t\t\tWHERE prices.typeabbrev = '" . $SalesType . "'\n\t\t\t\t\t\tAND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'\n\t\t\t\t\t\tAND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'\n\t\t\t\t\t\tAND prices.debtorno='" . $_SESSION['CustomerID'] . "'\n\t\t\t\t\t\tAND prices.startdate<='" . FormatDateForSQL($_POST['EffectiveDate']) . "'\n\t\t\t\t\t\tAND (prices.enddate='0000-00-00' OR prices.enddate >'" . FormatDateForSQL($_POST['EffectiveDate']) . "')\n\t\t\t\t\t\tORDER BY prices.currabrev,\n\t\t\t\t\t\t\tstockmaster.categoryid,\n\t\t\t\t\t\t\tstockmaster.stockid,\n\t\t\t\t\t\t\tprices.startdate";
 } else {
     /* the sales type list only */
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:PDFPriceList.php

示例5: _

     $InputError = 1;
     $msg = _('The price entered must be numeric');
 }
 if ($_POST['Branch'] != '') {
     $sql = "SELECT custbranch.branchcode\n\t\t\t\t\t\tFROM custbranch\n\t\t\t\t\t\tWHERE custbranch.debtorno='" . $_SESSION['CustomerID'] . "'\n\t\t\t\t\t\tAND custbranch.branchcode='" . $_POST['Branch'] . "'";
     $result = DB_query($sql, $db);
     if (DB_num_rows($result) == 0) {
         $InputError = 1;
         $msg = _('The branch code entered is not currently defined');
     }
 }
 if (!Is_Date($_POST['StartDate'])) {
     $InputError = 1;
     $msg = _('The date this price is to take effect from must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'];
 }
 if (!Is_Date($_POST['EndDate']) and $_POST['EndDate'] != '') {
     //EndDate can also be blank for default prices
     $InputError = 1;
     $msg = _('The date this price is be in effect to must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'];
 }
 if (Date1GreaterThanDate2($_POST['StartDate'], $_POST['EndDate']) and $_POST['EndDate'] != '') {
     $InputError = 1;
     $msg = _('The end date is expected to be after the start date, enter an end date after the start date for this price');
 }
 if (Date1GreaterThanDate2(Date($_SESSION['DefaultDateFormat']), $_POST['EndDate']) and $_POST['EndDate'] != '') {
     $InputError = 1;
     $msg = _('The end date is expected to be after today. There is no point entering a new price where the effective date is before today!');
 }
 if (isset($_POST['Editing']) and $_POST['Editing'] == 'Yes' and strlen($Item) > 1 and $InputError != 1) {
     //editing an existing price
     $sql = "UPDATE prices SET typeabbrev='" . $SalesType . "',\n\t\t                        currabrev='" . $CurrCode . "',\n\t\t\t\t\t\t\t\tprice='" . filter_currency_input($_POST['Price']) . "',\n\t\t\t\t\t\t\t\tunits='" . $_POST['Units'] . "',\n\t\t\t\t\t\t\t\tconversionfactor='" . filter_number_input($_POST['ConversionFactor']) . "',\n\t\t\t\t\t\t\t\tdecimalplaces='" . round($_POST['DecimalPlaces'], 0) . "',\n\t\t\t\t\t\t\t\tbranchcode='" . $_POST['Branch'] . "',\n\t\t\t\t\t\t\t\tstartdate='" . FormatDateForSQL($_POST['StartDate']) . "',\n\t\t\t\t\t\t\t\tenddate='" . FormatDateForSQL($_POST['EndDate']) . "'\n\t\t\t\tWHERE prices.stockid='" . $Item . "'\n\t\t\t\tAND prices.typeabbrev='" . $SalesType . "'\n\t\t\t\tAND prices.currabrev='" . $CurrCode . "'\n\t\t\t\tAND prices.startdate='" . $_POST['OldStartDate'] . "'\n\t\t\t\tAND prices.enddate='" . $_POST['OldEndDate'] . "'\n\t\t\t\tAND prices.debtorno='" . $_SESSION['CustomerID'] . "'";
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:Prices_Customer.php

示例6: VerifyLastPaidDate

function VerifyLastPaidDate($ClientSince, $i, $Errors)
{
    if (!Is_Date($ClientSince)) {
        $Errors[$i] = InvalidLastPaidDate;
    }
    return $Errors;
}
开发者ID:patmark,项目名称:weberp-elct,代码行数:7,代码来源:api_customers.php

示例7: update

function update(&$db, &$ChangeDate)
{
    // Change manufacturing flag for a date. The value "1" means the date is a manufacturing date.
    // After change the flag, re-calculate the daynumber for all dates.
    $InputError = 0;
    $CalDate = FormatDateForSQL($ChangeDate);
    $sql = "SELECT COUNT(*) FROM mrpcalendar\n\t\t  WHERE calendardate='{$CalDate}'\n\t\t  GROUP BY calendardate";
    $result = DB_query($sql);
    $myrow = DB_fetch_row($result);
    if ($myrow[0] < 1 || !Is_Date($ChangeDate)) {
        $InputError = 1;
        prnMsg(_('Invalid Change Date'), 'error');
    }
    if ($InputError == 1) {
        ShowInputForm($db, $ChangeDate);
        return;
    }
    $sql = "SELECT mrpcalendar.* FROM mrpcalendar WHERE calendardate='{$CalDate}'";
    $result = DB_query($sql);
    $myrow = DB_fetch_row($result);
    $newmanufacturingflag = 0;
    if ($myrow[2] == 0) {
        $newmanufacturingflag = 1;
    }
    $sql = "UPDATE mrpcalendar SET manufacturingflag = '" . $newmanufacturingflag . "'\n\t\t\tWHERE calendardate = '" . $CalDate . "'";
    $ErrMsg = _('Cannot update the MRP Calendar');
    $resultupdate = DB_query($sql, $ErrMsg);
    prnMsg(_('The MRP calendar record for') . ' ' . $ChangeDate . ' ' . _('has been updated'), 'success');
    unset($ChangeDate);
    ShowInputForm($db, $ChangeDate);
    // Have to update daynumber any time change a date from or to a manufacturing date
    // Update daynumber. Set it so non-manufacturing days will have the same daynumber as a valid
    // manufacturing day that precedes it. That way can read the table by the non-manufacturing day,
    // subtract the leadtime from the daynumber, and find the valid manufacturing day with that daynumber.
    $DayNumber = 1;
    $sql = "SELECT * FROM mrpcalendar ORDER BY calendardate";
    $result = DB_query($sql, $ErrMsg);
    while ($myrow = DB_fetch_array($result)) {
        if ($myrow['manufacturingflag'] == '1') {
            $DayNumber++;
        }
        $CalDate = $myrow['calendardate'];
        $sql = "UPDATE mrpcalendar SET daynumber = '" . $DayNumber . "'\n\t\t\t\t\tWHERE calendardate = '" . $CalDate . "'";
        $resultupdate = DB_query($sql, $ErrMsg);
    }
    // End of while
}
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:47,代码来源:MRPCalendar.php

示例8: _

     }
 }
 /*end while loop */
 // Print summary information for last part
 $YPos -= $line_height;
 $pdf->addTextWrap(40, $YPos, 130, $FontSize, $holddescription, '', 0, $fill);
 $pdf->addTextWrap(170, $YPos, 50, $FontSize, _('Unit Cost: '), 'center', 0, $fill);
 $pdf->addTextWrap(220, $YPos, 40, $FontSize, locale_number_format($holdcost, $_SESSION['CompanyRecord']['decimalplaces']), 'right', 0, $fill);
 $pdf->addTextWrap(260, $YPos, 50, $FontSize, locale_number_format($totalpartqty, $holddecimalplaces), 'right', 0, $fill);
 $pdf->addTextWrap(310, $YPos, 60, $FontSize, locale_number_format($totalpartcost, $_SESSION['CompanyRecord']['decimalplaces']), 'right', 0, $fill);
 $pdf->addTextWrap(370, $YPos, 30, $FontSize, _('M/B: '), 'right', 0, $fill);
 $pdf->addTextWrap(400, $YPos, 15, $FontSize, $holdmbflag, 'right', 0, $fill);
 // Get and print supplier info for part
 list($lastdate, $lastsupplier, $preferredsupplier) = GetPartInfo($db, $holdpart);
 $displaydate = $lastdate;
 if (!Is_Date($lastdate)) {
     $displaydate = ' ';
 }
 $YPos -= $line_height;
 $pdf->addTextWrap(50, $YPos, 80, $FontSize, _('Last Purchase Date: '), 'left', 0, $fill);
 $pdf->addTextWrap(130, $YPos, 60, $FontSize, $displaydate, 'left', 0, $fill);
 $pdf->addTextWrap(190, $YPos, 60, $FontSize, _('Supplier: '), 'left', 0, $fill);
 $pdf->addTextWrap(250, $YPos, 60, $FontSize, $lastsupplier, 'left', 0, $fill);
 $pdf->addTextWrap(310, $YPos, 120, $FontSize, _('Preferred Supplier: '), 'left', 0, $fill);
 $pdf->addTextWrap(430, $YPos, 60, $FontSize, $preferredsupplier, 'left', 0, $fill);
 $FontSize = 8;
 $YPos -= 2 * $line_height;
 if ($YPos < $Bottom_Margin + $line_height) {
     PrintHeader($pdf, $YPos, $PageNumber, $Page_Height, $Top_Margin, $Left_Margin, $Page_Width, $Right_Margin, $_POST['Consolidation'], $ReportDate);
     // include('includes/MRPPlannedPurchaseOrdersPageHeader.inc');
 }
开发者ID:strollClouds,项目名称:snkStudy,代码行数:31,代码来源:MRPPlannedPurchaseOrders.php

示例9: _

/* $Id: PDFLowGP.php 6165 2013-07-30 10:30:51Z daintree $*/
include 'includes/session.inc';
if (!isset($_POST['FromCat']) or $_POST['FromCat'] == '') {
    $Title = _('Low Gross Profit Sales');
}
$debug = 0;
if (isset($_POST['PrintPDF'])) {
    include 'includes/PDFStarter.php';
    $pdf->addInfo('Title', _('Low Gross Profit Sales'));
    $pdf->addInfo('Subject', _('Low Gross Profit Sales'));
    $FontSize = 10;
    $PageNumber = 1;
    $line_height = 12;
    $Title = _('Low GP sales') . ' - ' . _('Problem Report');
    if (!Is_Date($_POST['FromDate']) or !Is_Date($_POST['ToDate'])) {
        include 'includes/header.inc';
        prnMsg(_('The dates entered must be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
        include 'includes/footer.inc';
        exit;
    }
    /*Now figure out the data to report for the category range under review */
    $SQL = "SELECT stockmaster.categoryid,\n\t\t\t\t\tstockmaster.stockid,\n\t\t\t\t\tstockmoves.transno,\n\t\t\t\t\tstockmoves.trandate,\n\t\t\t\t\tsystypes.typename,\n\t\t\t\t\tstockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost as unitcost,\n\t\t\t\t\tstockmoves.qty,\n\t\t\t\t\tstockmoves.debtorno,\n\t\t\t\t\tstockmoves.branchcode,\n\t\t\t\t\tstockmoves.price*(1-stockmoves.discountpercent) as sellingprice,\n\t\t\t\t\t(stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS gp,\n\t\t\t\t\tdebtorsmaster.name\n\t\t\t\tFROM stockmaster INNER JOIN stockmoves\n\t\t\t\t\tON stockmaster.stockid=stockmoves.stockid\n\t\t\t\tINNER JOIN systypes\n\t\t\t\t\tON stockmoves.type=systypes.typeid\n\t\t\t\tINNER JOIN debtorsmaster\n\t\t\t\t\tON stockmoves.debtorno=debtorsmaster.debtorno\n\t\t\t\tWHERE stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\t\t\tAND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "'\n\t\t\t\tAND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . $_POST['GPMin'] / 100 . "\n\t\t\t\tORDER BY stockmaster.stockid";
    $LowGPSalesResult = DB_query($SQL, $db, '', '', false, false);
    if (DB_error_no($db) != 0) {
        include 'includes/header.inc';
        prnMsg(_('The low GP items could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db), 'error');
        echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
        if ($debug == 1) {
            echo '<br />' . $SQL;
        }
开发者ID:strollClouds,项目名称:snkStudy,代码行数:30,代码来源:PDFLowGP.php

示例10: _

<?php

/* $Id: Z_ReverseSuppPaymentRun.php 6941 2014-10-26 23:18:08Z daintree $*/
/* Script to delete all supplier payments entered or created from a payment run on a specified day
 */
include 'includes/session.inc';
$Title = _('Reverse and Delete Supplier Payments');
include 'includes/header.inc';
/*Only do deletions if user hits the button */
if (isset($_POST['RevPayts']) and Is_Date($_POST['PaytDate']) == 1) {
    $SQLTranDate = FormatDateForSQL($_POST['PaytDate']);
    $SQL = "SELECT id,\n\t\t\ttransno,\n\t\t\tsupplierno,\n\t\t\tovamount,\n\t\t\tsuppreference,\n\t\t\trate\n\t\tFROM supptrans\n\t\tWHERE supptrans.type = 22\n\t\tAND trandate = '" . $SQLTranDate . "'";
    $Result = DB_query($SQL);
    prnMsg(_('The number of payments that will be deleted is') . ' :' . DB_num_rows($Result), 'info');
    while ($Payment = DB_fetch_array($Result)) {
        prnMsg(_('Deleting payment number') . ' ' . $Payment['transno'] . ' ' . _('to supplier code') . ' ' . $Payment['supplierno'] . ' ' . _('for an amount of') . ' ' . $Payment['ovamount'], 'info');
        $SQL = "SELECT supptrans.transno,\n\t\t\t\tsupptrans.type,\n\t\t\t\tsuppallocs.amt\n\t\t\tFROM supptrans INNER JOIN suppallocs\n\t\t\tON supptrans.id=suppallocs.transid_allocto\n\t\t\tWHERE suppallocs.transid_allocfrom = " . $Payment['id'];
        $AllocsResult = DB_query($SQL);
        while ($Alloc = DB_fetch_array($AllocsResult)) {
            $SQL = "UPDATE supptrans SET settled=0,\n\t\t\t\t\t\t\t\t\t\talloc=alloc-" . $Alloc['amt'] . ",\n\t\t\t\t\t\t\t\t\t\tdiffonexch = diffonexch - ((" . $Alloc['amt'] . "/rate ) - " . $Alloc['amt'] / $Payment['rate'] . ")\n\t\t\t\t\tWHERE supptrans.type='" . $Alloc['type'] . "'\n\t\t\t\t\tAND transno='" . $Alloc['transno'] . "'";
            $ErrMsg = _('The update to the suppliers charges that were settled by the payment failed because');
            $UpdResult = DB_query($SQL, $ErrMsg);
        }
        prnMsg(' ... ' . _('reversed the allocations'), 'info');
        $SQL = "DELETE FROM suppallocs WHERE transid_allocfrom='" . $Payment['id'] . "'";
        $DelResult = DB_query($SQL);
        prnMsg(' ... ' . _('deleted the SuppAllocs records'), 'info');
        $SQL = "DELETE FROM supptrans\n\t\t\tWHERE type=22\n\t\t\tAND transno='" . $Payment['transno'] . "'\n\t\t\tAND trandate='" . $SQLTranDate . "'";
        $DelResult = DB_query($SQL);
        prnMsg(_('Deleted the SuppTran record'), 'success');
        $SQL = "DELETE FROM gltrans WHERE typeno='" . $Payment['transno'] . "' AND type=22";
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:Z_ReverseSuppPaymentRun.php

示例11: DB_query

    $result = DB_query($sql, $ErrMsg);
    prnMsg(_('Successfully deleted recurring sales order template number') . ' ' . $_POST['ExistingRecurrOrderNo'], 'success');
    echo '<p><a href="' . $RootPath . '/SelectRecurringSalesOrder.php">' . _('Select A Recurring Sales Order Template') . '</a>';
    unset($_SESSION['Items' . $identifier]->LineItems);
    unset($_SESSION['Items' . $identifier]);
    include 'includes/footer.inc';
    exit;
}
if (isset($_POST['Process'])) {
    $Result = DB_Txn_Begin();
    $InputErrors = 0;
    if (!Is_Date($_POST['StartDate'])) {
        $InputErrors = 1;
        prnMsg(_('The last recurrence or start date of this recurring order must be a valid date in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
    }
    if (!Is_Date($_POST['StopDate'])) {
        $InputErrors = 1;
        prnMsg(_('The end date of this recurring order must be a valid date in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
    }
    if (Date1GreaterThanDate2($_POST['StartDate'], $_POST['StopDate'])) {
        $InputErrors = 1;
        prnMsg(_('The end date of this recurring order must be after the start date'), 'error');
    }
    if (isset($_POST['MakeRecurringOrder']) and $_POST['Quotation'] == 1) {
        $InputErrors = 1;
        prnMsg(_('A recurring order cannot be made from a quotation'), 'error');
    }
    if ($InputErrors == 0) {
        /*Error checks above all passed ok so lets go*/
        if ($NewRecurringOrder == 'Yes') {
            /* finally write the recurring order header to the database and then the line details*/
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:RecurringSalesOrders.php

示例12: _

include 'includes/session.inc';
$title = _('Depreciation Journal Entry');
include 'includes/header.inc';
include 'includes/SQL_CommonFunctions.inc';
/*Get the last period depreciation (depn is transtype =44) was posted for */
$result = DB_query("SELECT periods.lastdate_in_period,\n\t\t\t\t\t\t\tmax(fixedassettrans.periodno)\n\t\t\t\t\tFROM fixedassettrans INNER JOIN periods\n\t\t\t\t\tON fixedassettrans.periodno=periods.periodno\n\t\t\t\t\tWHERE transtype=44\n\t\t\t\t\tGROUP BY periods.lastdate_in_period\n\t\t\t\t\tORDER BY periods.lastdate_in_period DESC", $db);
$LastDepnRun = DB_fetch_row($result);
$AllowUserEnteredProcessDate = true;
if (DB_num_rows($result) == 0) {
    //then depn has never been run yet?
    /*in this case default depreciation calc to the last day of last month - and allow user to select a period */
    if (!isset($_POST['ProcessDate'])) {
        $_POST['ProcessDate'] = Date($_SESSION['DefaultDateFormat'], mktime(0, 0, 0, date('m'), 0, date('Y')));
    } else {
        //ProcessDate is set - make sure it is on the last day of the month selected
        if (!Is_Date($_POST['ProcessDate'])) {
            prnMsg(_('The date is expected to be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
            $InputError = true;
        } else {
            $_POST['ProcessDate'] = LastDayOfMonth($_POST['ProcessDate']);
        }
    }
} else {
    //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;
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:FixedAssetDepreciation.php

示例13: unset

        }
    }
    /*Make sure the same receipt is not double processed by a page refresh */
    $_POST['Cancel'] = 1;
}
if (isset($_POST['Cancel'])) {
    unset($_POST['GLAmount']);
    unset($_POST['GLNarrative']);
    unset($_POST['GLCode']);
    unset($_POST['AccountName']);
}
/*set up the form whatever */
if (!isset($_POST['DatePaid'])) {
    $_POST['DatePaid'] = '';
}
if (isset($_POST['DatePaid']) and ($_POST['DatePaid'] == "" or !Is_Date($_SESSION['PaymentDetail']->DatePaid))) {
    $_POST['DatePaid'] = Date($_SESSION['DefaultDateFormat']);
    $_SESSION['PaymentDetail']->DatePaid = $_POST['DatePaid'];
}
if ($_SESSION['PaymentDetail']->Currency == '' and $_SESSION['PaymentDetail']->SupplierID == '') {
    $_SESSION['PaymentDetail']->Currency = $_SESSION['CompanyRecord']['currencydefault'];
}
if (isset($_POST['BankAccount']) and $_POST['BankAccount'] != '') {
    $SQL = "SELECT bankaccountname\n\t\t\tFROM bankaccounts,\n\t\t\t\tchartmaster\n\t\tWHERE bankaccounts.accountcode= chartmaster.accountcode\n\t\tAND chartmaster.accountcode='" . $_POST['BankAccount'] . "'";
    $ErrMsg = _('The bank account name cannot be retrieved because');
    $DbgMsg = _('SQL used to retrieve the bank account name was');
    $result = DB_query($SQL, $db, $ErrMsg, $DbgMsg);
    if (DB_num_rows($result) == 1) {
        $myrow = DB_fetch_row($result);
        $_SESSION['PaymentDetail']->BankAccountName = $myrow[0];
        unset($result);
开发者ID:ellymakuba,项目名称:AIRADS,代码行数:31,代码来源:Payments.php

示例14: submitcsv

function submitcsv(&$db, $PartNumber, $PartNumberOp, $SupplierId, $SupplierIdOp, $SupplierName, $SupplierNameOp, $SaveSummaryType)
{
    //initialize no input errors
    $InputError = 0;
    /* actions to take once the user has clicked the submit button
    	ie the page has called itself with some user input */
    //first off validate inputs sensible
    if (!Is_Date($_POST['FromDate'])) {
        $InputError = 1;
        prnMsg(_('Invalid From Date'), 'error');
    }
    if (!Is_Date($_POST['ToDate'])) {
        $InputError = 1;
        prnMsg(_('Invalid To Date'), 'error');
    }
    # Add more to WHERE statement, if user entered something for the part number,supplierid, name
    $WherePart = ' ';
    if (mb_strlen($PartNumber) > 0 && $PartNumberOp == 'LIKE') {
        $PartNumber = $PartNumber . '%';
    } else {
        $PartNumberOp = '=';
    }
    if (mb_strlen($PartNumber) > 0) {
        $WherePart = " AND purchorderdetails.itemcode " . $PartNumberOp . " '" . $PartNumber . "'  ";
    } else {
        $WherePart = ' ';
    }
    $WhereSupplierID = ' ';
    if ($SupplierIdOp == 'LIKE') {
        $SupplierId = $SupplierId . '%';
    } else {
        $SupplierIdOp = '=';
    }
    if (mb_strlen($SupplierId) > 0) {
        $WhereSupplierID = " AND purchorders.supplierno " . $SupplierIdOp . " '" . $SupplierId . "'  ";
    } else {
        $WhereSupplierID = ' ';
    }
    $WhereSupplierName = ' ';
    if (mb_strlen($SupplierName) > 0 && $SupplierNameOp == 'LIKE') {
        $SupplierName = $SupplierName . '%';
    } else {
        $SupplierNameOp = '=';
    }
    if (mb_strlen($SupplierName) > 0) {
        $WhereSupplierName = " AND suppliers.suppname " . $SupplierNameOp . " '" . $SupplierName . "'  ";
    } else {
        $WhereSupplierName = ' ';
    }
    if (mb_strlen($_POST['OrderNo']) > 0) {
        $WhereOrderNo = " AND purchorderdetails.orderno = '" . $_POST['OrderNo'] . "'  ";
    } else {
        $WhereOrderNo = ' ';
    }
    $WhereLineStatus = ' ';
    # Had to use IF statement instead of comparing 'linestatus' to $_POST['LineStatus']
    #in WHERE clause because the WHERE clause didn't recognize
    # that had used the IF statement to create a field called linestatus
    if ($_POST['LineStatus'] != 'All') {
        if ($_POST['DateType'] == 'Order') {
            $WhereLineStatus = " AND IF(purchorderdetails.quantityord = purchorderdetails.qtyinvoiced ||\n\t\t\t  purchorderdetails.completed = 1,'Completed','Open') = '" . $_POST['LineStatus'] . "'";
        } else {
            $WhereLineStatus = " AND IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') = '" . $_POST['LineStatus'] . "'";
        }
    }
    $WhereCategory = ' ';
    if ($_POST['Category'] != 'All') {
        $WhereCategory = " AND stockmaster.categoryid = '" . $_POST['Category'] . "'";
    }
    if ($InputError != 1) {
        $FromDate = FormatDateForSQL($_POST['FromDate']);
        $ToDate = FormatDateForSQL($_POST['ToDate']);
        if ($_POST['ReportType'] == 'Detail') {
            if ($_POST['DateType'] == 'Order') {
                $sql = "SELECT purchorderdetails.orderno,\n\t\t\t\t\t\t\t   purchorderdetails.itemcode,\n\t\t\t\t\t\t\t   purchorderdetails.deliverydate,\n\t\t\t\t\t\t\t   purchorders.supplierno,\n\t\t\t\t\t\t\t   purchorders.orddate,\n\t\t\t\t\t\t\t   purchorderdetails.quantityord,\n\t\t\t\t\t\t\t   purchorderdetails.qtyinvoiced,\n\t\t\t\t\t\t\t   (purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t   (purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost,\n\t\t\t\t\t\t\t   IF(purchorderdetails.quantityord = purchorderdetails.qtyinvoiced ||\n\t\t\t\t\t\t\t\t  purchorderdetails.completed = 1,'Completed','Open') as linestatus,\n\t\t\t\t\t\t\t   suppliers.suppname,\n\t\t\t\t\t\t\t   stockmaster.decimalplaces,\n\t\t\t\t\t\t\t   stockmaster.description\n\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\tORDER BY " . $_POST['SortBy'];
            } else {
                // Selects by delivery date from grns
                $sql = "SELECT purchorderdetails.orderno,\n\t\t\t\t\t\t\t   purchorderdetails.itemcode,\n\t\t\t\t\t\t\t   grns.deliverydate,\n\t\t\t\t\t\t\t   purchorders.supplierno,\n\t\t\t\t\t\t\t   purchorders.orddate,\n\t\t\t\t\t\t\t   grns.qtyrecd as quantityord,\n\t\t\t\t\t\t\t   grns.quantityinv as qtyinvoiced,\n\t\t\t\t\t\t\t   (grns.qtyrecd * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t   (grns.qtyrecd * grns.stdcostunit) as extcost,\n\t\t\t\t\t\t\t   IF(grns.qtyrecd - grns.quantityinv <> 0,'Open','Completed') as linestatus,\n\t\t\t\t\t\t\t   suppliers.suppname,\n\t\t\t\t\t\t\t   stockmaster.decimalplaces,\n\t\t\t\t\t\t\t   stockmaster.description\n\t\t\t\t\t\t\t   FROM grns\n\t\t\t\t\t\tLEFT JOIN purchorderdetails ON grns.podetailitem = purchorderdetails.podetailitem\n\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\tWHERE grns.deliverydate >='{$FromDate}'\n\t\t\t\t\t\t AND grns.deliverydate <='{$ToDate}'\n\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\tORDER BY " . $_POST['SortBy'];
            }
        } else {
            // sql for Summary report
            $orderby = $_POST['SummaryType'];
            // The following is because the 'extprice' summary is a special case - with the other
            // summaries, you group and order on the same field; with 'extprice', you are actually
            // grouping on the stkcode and ordering by extprice descending
            if ($_POST['SummaryType'] == 'extprice') {
                $_POST['SummaryType'] = 'itemcode';
                $orderby = 'extprice DESC';
            }
            if ($_POST['DateType'] == 'Order') {
                if ($_POST['SummaryType'] == 'extprice' || $_POST['SummaryType'] == 'itemcode') {
                    $sql = "SELECT purchorderdetails.itemcode,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord) as quantityord,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost,\n\t\t\t\t\t\t\t\t   stockmaster.decimalplaces,\n\t\t\t\t\t\t\t\t   stockmaster.description\n\t\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\t\tGROUP BY " . $_POST['SummaryType'] . ",stockmaster.decimalplaces,\n\t\t\t\t\t\t\t  stockmaster.description\n\t\t\t\t\t\t\tORDER BY " . $orderby;
                } elseif ($_POST['SummaryType'] == 'orderno') {
                    $sql = "SELECT purchorderdetails.orderno,\n\t\t\t\t\t\t\t\t   purchorders.supplierno,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord) as quantityord,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost,\n\t\t\t\t\t\t\t\t   suppliers.suppname\n\t\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\t\tGROUP BY " . $_POST['SummaryType'] . ",purchorders.supplierno,\n\t\t\t\t\t\t\t  suppliers.suppname\n\t\t\t\t\t\t\tORDER BY " . $orderby;
                } elseif ($_POST['SummaryType'] == 'supplierno' || $_POST['SummaryType'] == 'suppname,suppliers.supplierid') {
                    $sql = "SELECT purchorders.supplierno,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord) as quantityord,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost,\n\t\t\t\t\t\t\t\t   suppliers.suppname\n\t\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\t\tGROUP BY " . $_POST['SummaryType'] . ",purchorders.supplierno,\n\t\t\t\t\t\t\t  suppliers.suppname\n\t\t\t\t\t\t\tORDER BY " . $orderby;
                } elseif ($_POST['SummaryType'] == 'month') {
                    $sql = "SELECT EXTRACT(YEAR_MONTH from purchorders.orddate) as month,\n\t\t\t\t\t\t\t\t   CONCAT(MONTHNAME(purchorders.orddate),' ',YEAR(purchorders.orddate)) as monthname,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord) as quantityord,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost\n\t\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\t\tGROUP BY " . $_POST['SummaryType'] . ", monthname\n\t\t\t\t\t\t\tORDER BY " . $orderby;
                } elseif ($_POST['SummaryType'] == 'categoryid') {
                    $sql = "SELECT SUM(purchorderdetails.quantityord) as quantityord,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.qtyinvoiced) as qtyinvoiced,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.unitprice) as extprice,\n\t\t\t\t\t\t\t\t   SUM(purchorderdetails.quantityord * purchorderdetails.stdcostunit) as extcost,\n\t\t\t\t\t\t\t\t   stockmaster.categoryid,\n\t\t\t\t\t\t\t\t   stockcategory.categorydescription\n\t\t\t\t\t\t\t\t   FROM purchorderdetails\n\t\t\t\t\t\t\tINNER JOIN purchorders ON purchorders.orderno=purchorderdetails.orderno\n\t\t\t\t\t\t\tINNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid\n\t\t\t\t\t\t\tLEFT JOIN stockmaster ON purchorderdetails.itemcode = stockmaster.stockid\n\t\t\t\t\t\t\tINNER JOIN stockcategory ON stockcategory.categoryid = stockmaster.categoryid\n\t\t\t\t\t\t\tWHERE purchorders.orddate >='{$FromDate}'\n\t\t\t\t\t\t\t AND purchorders.orddate <='{$ToDate}'\n\t\t\t\t\t\t\t{$WherePart}\n\t\t\t\t\t\t\t{$WhereSupplierID}\n\t\t\t\t\t\t\t{$WhereSupplierName}\n\t\t\t\t\t\t\t{$WhereOrderNo}\n\t\t\t\t\t\t\t{$WhereLineStatus}\n\t\t\t\t\t\t\t{$WhereCategory}\n\t\t\t\t\t\t\tGROUP BY " . $_POST['SummaryType'] . ", categorydescription\n\t\t\t\t\t\t\tORDER BY " . $orderby;
//.........这里部分代码省略.........
开发者ID:strollClouds,项目名称:snkStudy,代码行数:101,代码来源:POReport.php

示例15: SUM

                } else {
                    $SQL = "SELECT salesorders.orderno, \n\t\t\t\t\t\tdebtorsmaster.name, \n\t\t\t\t\t\tcustbranch.brname, \n\t\t\t\t\t\tsalesorders.customerref, \n\t\t\t\t\t\tsalesorders.orddate, \n\t\t\t\t\t\tsalesorders.deliverto, \n\t\t\t\t\t\tsalesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue \n\t\t\t\t\tFROM salesorders, \n\t\t\t\t\t\tsalesorderdetails, \n\t\t\t\t\t\tdebtorsmaster, \n\t\t\t\t\t\tcustbranch \n\t\t\t\t\tWHERE salesorders.orderno = salesorderdetails.orderno \n\t\t\t\t\tAND salesorders.debtorno = debtorsmaster.debtorno \n\t\t\t\t\tAND salesorders.branchcode = custbranch.branchcode \n\t\t\t\t\tAND debtorsmaster.debtorno = custbranch.debtorno \n\t\t\t\t\tAND salesorders.orddate >= '{$DateAfterCriteria}' \n\t\t\t\t\tAND salesorders.quotation=0 \n\t\t\t\t\tAND salesorderdetails.completed" . $completed . " \n\t\t\t\t\tGROUP BY salesorders.orderno, \n\t\t\t\t\t\tdebtorsmaster.name, \n\t\t\t\t\t\tcustbranch.brname, \n\t\t\t\t\t\tsalesorders.customerref, \n\t\t\t\t\t\tsalesorders.orddate, \n\t\t\t\t\t\tsalesorders.deliverydate,  \n\t\t\t\t\t\tsalesorders.deliverto\n\t\t\t\t\tORDER BY salesorders.orderno";
                }
            }
            //end selected customer
        }
        //end not order number selected
        $SalesOrdersResult = DB_query($SQL, $db);
        if (DB_error_no($db) != 0) {
            echo '<br>' . _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db);
            echo "<br>{$SQL}";
        }
    }
}
//end of which button clicked options
if (!isset($_POST['OrdersAfterDate']) or $_POST['OrdersAfterDate'] == '' or !Is_Date($_POST['OrdersAfterDate'])) {
    $_POST['OrdersAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 2, Date('d'), Date('Y')));
}
echo "<table>";
if (!isset($OrderNumber) or $OrderNumber == '') {
    echo '<tr><td>' . _('Order Number') . ':</td><td>' . "<input type='text' name='OrderNumber' maxlength =8 size=9></td><td>" . _('for all orders placed after') . ": </td><td><input type='text' name='OrdersAfterDate' maxlength =10 size=11 value=" . $_POST['OrdersAfterDate'] . "></td><td>" . "<input type='submit' name='SearchOrders' value='" . _('Search Orders') . "'></td></tr>";
    echo '<tr><td>' . _('Customer Ref') . ':</td><td>' . "<input type='text' name='CustomerRef' maxlength =8 size=9></td>\n\t\t\t<td></td><td colspan=2><input type='checkbox' " . $ShowChecked . " name='completed' />" . _('Show Completed orders only') . "</td></tr>";
}
echo '</table>';
if (!isset($SelectedStockItem)) {
    $SQL = 'SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription';
    $result1 = DB_query($SQL, $db);
    echo '<hr>';
    echo '<div class="centre"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . '   </font>';
    echo '<input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '">';
    if (count($_SESSION['AllowedPageSecurityTokens']) > 1) {
开发者ID:bodi000,项目名称:weberp-cvs,代码行数:31,代码来源:SelectCompletedOrder.php


注:本文中的Is_Date函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。