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


PHP FormatDateForSQL函数代码示例

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


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

示例1: 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);
     }
 }
开发者ID:rrsc,项目名称:KwaMoja,代码行数:14,代码来源:DefineWOClass.php

示例2: Save

 function Save($db, $Update = '')
 {
     if ($Update == '') {
         foreach ($this->LineItems as $LineItems) {
             if ($LineItems->Deleted == False) {
                 $sql = "INSERT INTO offers (\tsupplierid,\n\t\t\t\t\t\t\t\t\t\t\t\ttenderid,\n\t\t\t\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\t\t\t\t\t\tuom,\n\t\t\t\t\t\t\t\t\t\t\t\tprice,\n\t\t\t\t\t\t\t\t\t\t\t\texpirydate,\n\t\t\t\t\t\t\t\t\t\t\t\tcurrcode)\n\t\t\t\t\t\tVALUES ('" . $this->SupplierID . "',\n\t\t\t\t\t\t\t\t'" . $this->TenderID . "',\n\t\t\t\t\t\t\t\t'" . $LineItems->StockID . "',\n\t\t\t\t\t\t\t\t'" . $LineItems->Quantity . "',\n\t\t\t\t\t\t\t\t'" . $LineItems->Units . "',\n\t\t\t\t\t\t\t\t'" . $LineItems->Price . "',\n\t\t\t\t\t\t\t\t'" . FormatDateForSQL($LineItems->ExpiryDate) . "',\n\t\t\t\t\t\t\t\t'" . $this->CurrCode . "')";
                 $ErrMsg = _('The suppliers offer could not be inserted into the database because');
                 $DbgMsg = _('The SQL statement used to insert the suppliers offer record and failed was');
                 $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
                 if (DB_error_no($db) == 0) {
                     prnMsg(_('The offer for') . ' ' . $LineItems->StockID . ' ' . _('has been inserted into the database'), 'success');
                     $this->OfferMailText .= $LineItems->Quantity . ' ' . $LineItems->Units . ' ' . _('of') . ' ' . $LineItems->StockID . ' ' . _('at a price of') . ' ' . $this->CurrCode . number_format($LineItems->Price, 2) . "\n";
                 } else {
                     prnMsg(_('The offer for') . ' ' . $LineItems->StockID . ' ' . _('could not be inserted into the database'), 'error');
                     include 'includes/footer.inc';
                     exit;
                 }
             }
         }
     } else {
         foreach ($this->LineItems as $LineItem) {
             if ($LineItem->Deleted == false) {
                 //Update only the LineItems which is not flagged as deleted
                 $sql = "UPDATE offers SET\n\t\t\t\t\t\tquantity='" . $LineItem->Quantity . "',\n\t\t\t\t\t\tprice='" . $LineItem->Price . "',\n\t\t\t\t\t\texpirydate='" . FormatDateForSQL($LineItem->ExpiryDate) . "'\n\t\t\t\t\tWHERE offerid='" . $LineItem->LineNo . "'";
                 $ErrMsg = _('The suppliers offer could not be updated on the database because');
                 $DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was');
                 $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
                 if (DB_error_no($db) == 0) {
                     prnMsg(_('The offer for') . ' ' . $LineItem->StockID . ' ' . _('has been updated in the database'), 'success');
                     $this->OfferMailText .= $LineItem->Quantity . ' ' . $LineItem->Units . ' ' . _('of') . ' ' . $LineItem->StockID . ' ' . _('at a price of') . ' ' . $this->CurrCode . $LineItem->Price . "\n";
                 } else {
                     prnMsg(_('The offer for') . ' ' . $LineItem->StockID . ' ' . _('could not be updated in the database'), 'error');
                     include 'includes/footer.inc';
                     exit;
                 }
             } else {
                 // the LineItem is Deleted flag is true so delete it
                 $sql = "DELETE from offers WHERE offerid='" . $LineItem->LineNo . "'";
                 $ErrMsg = _('The supplier offer could not be deleted on the database because');
                 $DbgMsg = _('The SQL statement used to delete the suppliers offer record are failed was');
                 $result = DB_query($sql, $db, $ErrMsg, $DbgMsg, true);
                 if (DB_error_no($db) == 0) {
                     prnMsg(_('The offer for') . ' ' . $LineItem->StockID . ' ' . _('has been deleted in the database'), 'info');
                     $this->OfferMailText .= $LineItem->Quantity . ' ' . $LineItem->Units . ' ' . _('of') . ' ' . $LineItem->StockID . ' ' . _('at a price of') . ' ' . $this->CurrCode . $LineItem->Price . ' ' . _('has been deleted') . "\n";
                 }
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:49,代码来源:DefineOfferClass.php

示例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);
 }
开发者ID:rrsc,项目名称:KwaMoja,代码行数:36,代码来源:DefineTenderClass.php

示例4: ReSequenceEffectiveDates

function ReSequenceEffectiveDates($Item, $PriceList, $CurrAbbrev, $QuantityBreak, $db)
{
    /*This is quite complicated - the idea is that prices set up should be unique and there is no way two prices could be returned as valid - when getting a price in includes/GetPrice.inc the logic is to first look for a price of the salestype/currency within the effective start and end dates - then if not get the price with a start date prior but a blank end date (the default price). We would not want two prices where one price falls inside another effective date range except in the case of a blank end date - ie no end date - the default price for the currency/salestype.
    	I first thought that we would need to update the previous default price (blank end date), when a new default price is entered, to have an end date of the startdate of this new default price less 1 day - but this is  converting a default price into a special price which could result in having two special prices over the same date range - best to leave it unchanged and use logic in the GetPrice.inc to ensure the correct default price is returned
    	*
    	* After further discussion (Ricard) if the new price has a blank end date - i.e. no end then the pre-existing price with no end date should be changed to have an end date just prior to the new default (no end date) price commencing
    	*/
    //this is just the case where debtorno='' - see the Prices_Customer.php script for customer special prices
    $SQL = "SELECT price,\r\n\t\t\t\t\t\tstartdate,\r\n\t\t\t\t\t\tenddate\r\n\t\t\t\tFROM pricematrix\r\n\t\t\t\tWHERE stockid='" . $Item . "'\r\n\t\t\t\tAND currabrev='" . $CurrAbbrev . "'\r\n\t\t\t\tAND salestype='" . $PriceList . "'\r\n\t\t\t\tAND quantitybreak='" . $QuantityBreak . "'\r\n\t\t\t\tORDER BY startdate, enddate";
    $result = DB_query($SQL);
    while ($myrow = DB_fetch_array($result)) {
        if (isset($NextStartDate)) {
            if (Date1GreaterThanDate2(ConvertSQLDate($myrow['startdate']), $NextStartDate)) {
                $NextStartDate = ConvertSQLDate($myrow['startdate']);
                //Only if the previous enddate is after the new start date do we need to look at updates
                if (Date1GreaterThanDate2(ConvertSQLDate($EndDate), ConvertSQLDate($myrow['startdate']))) {
                    /*Need to make the end date the new start date less 1 day */
                    $SQL = "UPDATE pricematrix SET enddate = '" . FormatDateForSQL(DateAdd($NextStartDate, 'd', -1)) . "'\r\n\t\t\t\t\t\t\t\t\t\tWHERE stockid ='" . $Item . "'\r\n\t\t\t\t\t\t\t\t\t\tAND currabrev='" . $CurrAbbrev . "'\r\n\t\t\t\t\t\t\t\t\t\tAND salestype='" . $PriceList . "'\r\n\t\t\t\t\t\t\t\t\t\tAND startdate ='" . $StartDate . "'\r\n\t\t\t\t\t\t\t\t\t\tAND enddate = '" . $EndDate . "'\r\n\t\t\t\t\t\t\t\t\t\tAND quantitybreak ='" . $QuantityBreak . "'";
                    $UpdateResult = DB_query($SQL);
                }
            }
            //end of if startdate  after NextStartDate - we have a new NextStartDate
        } else {
            $NextStartDate = ConvertSQLDate($myrow['startdate']);
        }
        $StartDate = $myrow['startdate'];
        $EndDate = $myrow['enddate'];
        $Price = $myrow['price'];
    }
    // end of loop around all prices
}
开发者ID:fgaudenzi,项目名称:webERP-bootstrap,代码行数:31,代码来源:PriceMatrix.php

示例5: filter_number_format

 $Tag = $_POST[$RequestID . 'Tag' . $LineID];
 $RequestedQuantity = filter_number_format($_POST[$RequestID . 'RequestedQuantity' . $LineID]);
 if (isset($_POST[$RequestID . 'Completed' . $LineID])) {
     $Completed = True;
 } else {
     $Completed = False;
 }
 $sql = "SELECT materialcost, labourcost, overheadcost, decimalplaces FROM stockmaster WHERE stockid='" . $StockID . "'";
 $result = DB_query($sql, $db);
 $myrow = DB_fetch_array($result);
 $StandardCost = $myrow['materialcost'] + $myrow['labourcost'] + $myrow['overheadcost'];
 $DecimalPlaces = $myrow['decimalplaces'];
 $Narrative = _('Issue') . ' ' . $Quantity . ' ' . _('of') . ' ' . $StockID . ' ' . _('to department') . ' ' . $Department . ' ' . _('from') . ' ' . $Location;
 $AdjustmentNumber = GetNextTransNo(17, $db);
 $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
 $SQLAdjustmentDate = 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\t\t\tFROM locstock\n\t\t\t\t\tWHERE locstock.stockid='" . $StockID . "'\n\t\t\t\t\t\tAND loccode= '" . $Location . "'";
 $Result = DB_query($SQL, $db);
 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;
 }
 if ($_SESSION['ProhibitNegativeStock'] == 0 or $_SESSION['ProhibitNegativeStock'] == 1 and $QtyOnHandPrior >= $Quantity) {
     $SQL = "INSERT INTO stockmoves (\n\t\t\t\t\t\t\t\t\tstockid,\n\t\t\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t\t\ttransno,\n\t\t\t\t\t\t\t\t\tloccode,\n\t\t\t\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\t\t\t\tprd,\n\t\t\t\t\t\t\t\t\treference,\n\t\t\t\t\t\t\t\t\tqty,\n\t\t\t\t\t\t\t\t\tnewqoh)\n\t\t\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t\t'" . $StockID . "',\n\t\t\t\t\t\t\t\t\t17,\n\t\t\t\t\t\t\t\t\t'" . $AdjustmentNumber . "',\n\t\t\t\t\t\t\t\t\t'" . $Location . "',\n\t\t\t\t\t\t\t\t\t'" . $SQLAdjustmentDate . "',\n\t\t\t\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t\t\t\t'" . $Narrative . "',\n\t\t\t\t\t\t\t\t\t'" . -$Quantity . "',\n\t\t\t\t\t\t\t\t\t'" . ($QtyOnHandPrior - $Quantity) . "'\n\t\t\t\t\t\t\t\t)";
     $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record cannot be inserted because');
     $DbgMsg = _('The following SQL to insert the stock movement record was used');
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:InternalStockRequestFulfill.php

示例6: _

             $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the tax could not be added because');
             $DbgMsg = _('The following SQL to insert the GL transaction was used');
             $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
         }
         /* if the tax is not 0 */
     }
     /*end of loop to post the tax */
     /* Now the control account */
     $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\t\t VALUES (21,\n\t\t\t\t\t \t'" . $CreditNoteNo . "',\n\t\t\t\t\t\t'" . $SQLCreditNoteDate . "',\n\t\t\t\t\t\t'" . $PeriodNo . "',\n\t\t\t\t\t\t'" . $_SESSION['SuppTrans']->CreditorsAct . "',\n\t\t\t\t\t\t'" . $_SESSION['SuppTrans']->SupplierID . ' - ' . _('Credit Note') . ' ' . $_SESSION['SuppTrans']->SuppReference . ' ' . $_SESSION['SuppTrans']->CurrCode . locale_number_format($_SESSION['SuppTrans']->OvAmount + $_SESSION['SuppTrans']->OvGST, $_SESSION['SuppTrans']->CurrDecimalPlaces) . ' @ ' . _('a rate of') . ' ' . $_SESSION['SuppTrans']->ExRate . "',\n\t\t\t\t\t\t'" . ($LocalTotal + $TaxTotal / $_SESSION['SuppTrans']->ExRate) . "')";
     $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the control total could not be added because');
     $DbgMsg = _('The following SQL to insert the GL transaction was used');
     $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
 }
 /*Thats the end of the GL postings */
 /*Now insert the credit note into the SuppTrans table*/
 $SQL = "INSERT INTO supptrans (transno,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tsupplierno,\n\t\t\t\t\t\tsuppreference,\n\t\t\t\t\t\ttrandate,\n\t\t\t\t\t\tduedate,\n\t\t\t\t\t\tinputdate,\n\t\t\t\t\t\tovamount,\n\t\t\t\t\t\tovgst,\n\t\t\t\t\t\trate,\n\t\t\t\t\t\ttranstext)\n\t\t\t\tVALUES (\n\t\t\t\t\t'" . $CreditNoteNo . "',\n\t\t\t\t\t21,\n\t\t\t\t\t'" . $_SESSION['SuppTrans']->SupplierID . "',\n\t\t\t\t\t'" . $_SESSION['SuppTrans']->SuppReference . "',\n\t\t\t\t\t'" . $SQLCreditNoteDate . "',\n\t\t\t\t\t'" . FormatDateForSQL($_SESSION['SuppTrans']->DueDate) . "',\n\t\t\t\t\t'" . Date('Y-m-d H-i-s') . "',\n\t\t\t\t\t'" . -$_SESSION['SuppTrans']->OvAmount . "',\n\t\t\t\t\t'" . -$TaxTotal . "',\n\t\t\t\t\t'" . $_SESSION['SuppTrans']->ExRate . "',\n\t\t\t\t\t'" . $_SESSION['SuppTrans']->Comments . "')";
 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The supplier credit note transaction could not be added to the database because');
 $DbgMsg = _('The following SQL to insert the supplier credit note was used');
 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True);
 $SuppTransID = DB_Last_Insert_ID($db, 'supptrans', 'id');
 /* Insert the tax totals for each tax authority where tax was charged on the invoice */
 foreach ($_SESSION['SuppTrans']->Taxes as $TaxTotals) {
     $SQL = "INSERT INTO supptranstaxes (supptransid,\n\t\t\t\t\t\t\t\t\t\t\t\ttaxauthid,\n\t\t\t\t\t\t\t\t\t\t\t\ttaxamount)\n\t\t\t\t\t\t\t\t\tVALUES ('" . $SuppTransID . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TaxTotals->TaxAuthID . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . -$TaxTotals->TaxOvAmount . "')";
     $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The supplier transaction taxes records could not be inserted because');
     $DbgMsg = _('The following SQL to insert the supplier transaction taxes record was used:');
     $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
 }
 /* Now update the GRN and PurchOrderDetails records for amounts invoiced 
  * can't use the previous loop around GRNs as this was only for where the creditors->GL link was active*/
 foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN) {
     $SQL = "UPDATE purchorderdetails SET qtyinvoiced = qtyinvoiced - " . $EnteredGRN->This_QuantityInv . " \n\t\t\t\t\tWHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'";
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:SupplierCredit.php

示例7: DB_Txn_Begin

    }
}
if (isset($_POST['Submit'])) {
    DB_Txn_Begin($db);
    $InputError = 0;
    if ($_SESSION['Request']->Department == '') {
        prnMsg(_('You must select a Department for the request'), 'error');
        $InputError = 1;
    }
    if ($_SESSION['Request']->Location == '') {
        prnMsg(_('You must select a Location to request the items from'), 'error');
        $InputError = 1;
    }
    if ($InputError == 0) {
        $RequestNo = GetNextTransNo(38, $db);
        $HeaderSQL = "INSERT INTO stockrequest (dispatchid,\r\n\t\t\t\t\t\t\t\t\t\t\tloccode,\r\n\t\t\t\t\t\t\t\t\t\t\tdepartmentid,\r\n\t\t\t\t\t\t\t\t\t\t\tdespatchdate,\r\n\t\t\t\t\t\t\t\t\t\t\tnarrative)\r\n\t\t\t\t\t\t\t\t\t\tVALUES(\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $RequestNo . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Request']->Location . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Request']->Department . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($_SESSION['Request']->DispatchDate) . "',\r\n\t\t\t\t\t\t\t\t\t\t\t'" . $_SESSION['Request']->Narrative . "')";
        $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The request header record could not be inserted because');
        $DbgMsg = _('The following SQL to insert the request header record was used');
        $Result = DB_query($HeaderSQL, $db, $ErrMsg, $DbgMsg, true);
        foreach ($_SESSION['Request']->LineItems as $LineItems) {
            $LineSQL = "INSERT INTO stockrequestitems (dispatchitemsid,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdispatchid,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tstockid,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tquantity,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tdecimalplaces,\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tuom)\r\n\t\t\t\t\t\t\t\t\t\t\t\tVALUES(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->LineNumber . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $RequestNo . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->StockID . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->Quantity . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->DecimalPlaces . "',\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'" . $LineItems->UOM . "')";
            $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The request line record could not be inserted because');
            $DbgMsg = _('The following SQL to insert the request header record was used');
            $Result = DB_query($LineSQL, $db, $ErrMsg, $DbgMsg, true);
        }
        $EmailSQL = "SELECT email\r\n\t\t\t\t\tFROM www_users, departments\r\n\t\t\t\t\tWHERE departments.authoriser = www_users.userid\r\n\t\t\t\t\t\tAND departments.departmentid = '" . $_SESSION['Request']->Department . "'";
        $EmailResult = DB_query($EmailSQL, $db);
        if ($myEmail = DB_fetch_array($EmailResult)) {
            $ConfirmationText = _('An internal stock request has been created and is waiting for your authoritation');
            $EmailSubject = _('Internal Stock Request needs your authoritation');
            mail($myEmail['email'], $EmailSubject, $ConfirmationText);
开发者ID:BackupTheBerlios,项目名称:kwamoja,代码行数:31,代码来源:InternalStockRequest.php

示例8: DB_query

    $InsertQryResult = DB_query($HeaderSQL, $db, $ErrMsg, $DbgMsg, true);
    foreach ($_SESSION['Items' . $identifier]->LineItems as $StockItem) {
        /* Check to see if the quantity reduced to the same quantity
        		as already invoiced - so should set the line to completed */
        if ($StockItem->Quantity == $StockItem->QtyInv) {
            $Completed = 1;
        } else {
            /* order line is not complete */
            $Completed = 0;
        }
        $LineItemsSQL = 'UPDATE salesorderdetails SET unitprice=' . $StockItem->Price . ',
								quantity=' . $StockItem->Quantity . ',
								discountpercent=' . floatval($StockItem->DiscountPercent) . ',
								completed=' . $Completed . ',
								poline=' . "'" . $StockItem->POLine . "'" . ',
								itemdue=' . "'" . FormatDateForSQL($StockItem->ItemDue) . "'" . '
					WHERE salesorderdetails.orderno=' . $_SESSION['ExistingOrder'] . '
					AND salesorderdetails.orderlineno=' . "'" . $StockItem->LineNumber . "'";
        $DbgMsg = _('The SQL that was used to modify the order line and failed was');
        $ErrMsg = _('The updated order line cannot be modified because');
        $Upd_LineItemResult = DB_query($LineItemsSQL, $db, $ErrMsg, $DbgMsg, true);
    }
    /* updated line items into sales order details */
    $Result = DB_Txn_Commit($db);
    unset($_SESSION['Items' . $identifier]->LineItems);
    unset($_SESSION['Items' . $identifier]);
    prnMsg(_('Order number') . ' ' . $_SESSION['ExistingOrder'] . ' ' . _('has been updated'), 'success');
    echo '<br><a href="' . $rootpath . '/PrintCustOrder.php?' . SID . 'identifier=' . $identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">' . _('Print packing slip - pre-printed stationery') . '</a>';
    echo '<p><a href="' . $rootpath . '/ConfirmDispatch_Invoice.php?' . SID . 'identifier=' . $identifier . '&OrderNumber=' . $_SESSION['ExistingOrder'] . '">' . _('Confirm Order Delivery Quantities and Produce Invoice') . '</a>';
    echo '<br><a  target="_blank" href="' . $rootpath . '/PrintCustOrder_generic.php?' . SID . 'identifier=' . $identifier . '&TransNo=' . $_SESSION['ExistingOrder'] . '">' . _('Print packing slip') . ' (' . _('Laser') . ')' . '</a>';
    echo '<p><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . 'identifier=' . $identifier . '">' . _('Select A Different Order') . '</a>';
开发者ID:bodi000,项目名称:weberp-cvs,代码行数:31,代码来源:DeliveryDetails.php

示例9: 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) {
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:StockStatus.php

示例10: _

        $PageNumber++;
        include 'includes/PDFDeliveryDifferencesPageHeader.inc';
    }
    /*end of new page header  */
}
/* end of while there are delivery differences to print */
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('Total number of differences') . ' ' . locale_number_format($TotalDiffs), 'left');
if ($_POST['CategoryID'] == 'All' and $_POST['Location'] == 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\t\tFROM salesorderdetails INNER JOIN debtortrans\n\t\t\t\tON salesorderdetails.orderno=debtortrans.order_\n\t\t\tWHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\t\tAND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'";
} elseif ($_POST['CategoryID'] != 'All' and $_POST['Location'] == 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans\n\t\t\tON salesorderdetails.orderno=debtortrans.order_ INNER JOIN stockmaster\n\t\t\tON salesorderdetails.stkcode=stockmaster.stockid\n\t\tWHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'\n\t\tAND stockmaster.categoryid='" . $_POST['CategoryID'] . "'";
} elseif ($_POST['CategoryID'] == 'All' and $_POST['Location'] != 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans\n\t\t\tON salesorderdetails.orderno=debtortrans.order_ INNER JOIN salesorders\n\t\t\tON salesorderdetails.orderno = salesorders.orderno\n\t\tWHERE debtortrans.trandate>='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND debtortrans.trandate <='" . FormatDateForSQL($_POST['ToDate']) . "'\n\t\tAND salesorders.fromstkloc='" . $_POST['Location'] . "'";
} elseif ($_POST['CategoryID'] != 'All' and $_POST['Location'] != 'All') {
    $sql = "SELECT COUNT(salesorderdetails.orderno)\n\t\tFROM salesorderdetails INNER JOIN debtortrans ON salesorderdetails.orderno=debtortrans.order_\n\t\t\tINNER JOIN salesorders ON salesorderdetails.orderno = salesorders.orderno\n\t\t\tINNER JOIN stockmaster ON salesorderdetails.stkcode = stockmaster.stockid\n\t\tWHERE salesorders.fromstkloc ='" . $_POST['Location'] . "'\n\t\tAND categoryid='" . $_POST['CategoryID'] . "'\n\t\tAND trandate >='" . FormatDateForSQL($_POST['FromDate']) . "'\n\t\tAND trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "'";
}
if ($_SESSION['SalesmanLogin'] != '') {
    $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
}
$ErrMsg = _('Could not retrieve the count of sales order lines in the period under review');
$result = DB_query($sql, $db, $ErrMsg);
$myrow = DB_fetch_row($result);
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('Total number of order lines') . ' ' . locale_number_format($myrow[0]), 'left');
$YPos -= $line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 200, $FontSize, _('DIFOT') . ' ' . locale_number_format((1 - $TotalDiffs / $myrow[0]) * 100, 2) . '%', 'left');
$ReportFileName = $_SESSION['DatabaseName'] . '_DeliveryDifferences_' . date('Y-m-d') . '.pdf';
$pdf->OutputD($ReportFileName);
if ($_POST['Email'] == 'Yes') {
    if (file_exists($_SESSION['reports_dir'] . '/' . $ReportFileName)) {
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:PDFDeliveryDifferences.php

示例11: prnMsg

 if (!Is_Date($DatePurchased)) {
     $InputError = true;
     prnMsg(_('The date purchased must be entered in the format:') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
     echo '<br />' . _('Row:') . $Row . ' - ' . _('Invalid date format:') . ' ' . $DatePurchased;
 }
 if ($DepnType == 'DV') {
     $DepnType = 1;
 } else {
     $DepnType = 0;
 }
 if ($InputError == false) {
     //no errors
     $TransNo = GetNextTransNo(49, $db);
     $PeriodNo = GetPeriod(ConvertSQLDate($_POST['DateToEnter']), $db);
     //attempt to insert the stock item
     $sql = "INSERT INTO fixedassets (description,\n\t\t\t\t\t\t\t\t\t\t\tlongdescription,\n\t\t\t\t\t\t\t\t\t\t\tassetcategoryid,\n\t\t\t\t\t\t\t\t\t\t\tserialno,\n\t\t\t\t\t\t\t\t\t\t\tbarcode,\n\t\t\t\t\t\t\t\t\t\t\tassetlocation,\n\t\t\t\t\t\t\t\t\t\t\tcost,\n\t\t\t\t\t\t\t\t\t\t\taccumdepn,\n\t\t\t\t\t\t\t\t\t\t\tdepntype,\n\t\t\t\t\t\t\t\t\t\t\tdepnrate,\n\t\t\t\t\t\t\t\t\t\t\tdatepurchased)\n\t\t\t\t\t\t\tVALUES ('" . $Description . "',\n\t\t\t\t\t\t\t\t\t'" . $LongDescription . "',\n\t\t\t\t\t\t\t\t\t'" . $AssetCategoryID . "',\n\t\t\t\t\t\t\t\t\t'" . $SerialNo . "',\n\t\t\t\t\t\t\t\t\t'" . $BarCode . "',\n\t\t\t\t\t\t\t\t\t'" . $AssetLocationCode . "',\n\t\t\t\t\t\t\t\t\t'" . $Cost . "',\n\t\t\t\t\t\t\t\t\t'" . $AccumDepn . "',\n\t\t\t\t\t\t\t\t\t'" . $DepnType . "',\n\t\t\t\t\t\t\t\t\t'" . $DepnRate . "',\n\t\t\t\t\t\t\t\t\t'" . FormatDateForSQL($DatePurchased) . "')";
     $ErrMsg = _('The asset could not be added because');
     $DbgMsg = _('The SQL that was used to add the asset and failed was');
     $result = DB_query($sql, $db, $ErrMsg, $DbgMsg);
     if (DB_error_no($db) == 0) {
         //the insert of the new code worked so bang in the fixedassettrans records too
         $AssetID = DB_Last_Insert_ID($db, 'fixedassets', 'assetid');
         $sql = "INSERT INTO fixedassettrans ( assetid,\n\t\t\t\t\t\t\t\t\t\t\t\ttranstype,\n\t\t\t\t\t\t\t\t\t\t\t\ttransno,\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\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\tinputdate,\n\t\t\t\t\t\t\t\t\t\t\t\tfixedassettranstype,\n\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\tVALUES ( '" . $AssetID . "',\n\t\t\t\t\t\t\t\t\t\t\t'49',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['DateToEnter'] . "',\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'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t'cost',\n\t\t\t\t\t\t\t\t\t\t\t'" . $Cost . "')";
         $ErrMsg = _('The transaction for the cost of the asset could not be added because');
         $DbgMsg = _('The SQL that was used to add the fixedasset trans record that failed was');
         $InsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
         $sql = "INSERT INTO fixedassettrans ( assetid,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttranstype,\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransno,\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\tperiodno,\n\t\t\t\t\t\t\t\t\t\t\t\t\tinputdate,\n\t\t\t\t\t\t\t\t\t\t\t\t\tfixedassettranstype,\n\t\t\t\t\t\t\t\t\t\t\t\t\tamount)\n\t\t\t\t\t\t\t\t\tVALUES ( '" . $AssetID . "',\n\t\t\t\t\t\t\t\t\t\t\t'49',\n\t\t\t\t\t\t\t\t\t\t\t'" . $TransNo . "',\n\t\t\t\t\t\t\t\t\t\t\t'" . $_POST['DateToEnter'] . "',\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'" . Date('Y-m-d') . "',\n\t\t\t\t\t\t\t\t\t\t\t'depn',\n\t\t\t\t\t\t\t\t\t\t\t'" . $AccumDepn . "')";
         $ErrMsg = _('The transaction for the cost of the asset could not be added because');
         $DbgMsg = _('The SQL that was used to add the fixedasset trans record that failed was');
         $InsResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
         if (DB_error_no($db) == 0) {
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:Z_ImportFixedAssets.php

示例12: _

				<option value="11">' . _('Credit Notes') . '</option>
				<option value="12">' . _('Receipts') . '</option>';
    echo '</select></td></tr>
			</table>
			<div class="centre">
				<br />
				<input type="submit" name="Go" value="' . _('Create PDF') . '" />
			</div>
			</form>
			</div>';
    include 'includes/footer.inc';
    exit;
} else {
    include 'includes/ConnectDB.inc';
}
$sql = "SELECT type,\n\t\t\tdebtortrans.debtorno,\n\t\t\ttransno,\n\t\t\ttrandate,\n\t\t\tovamount,\n\t\t\tovgst,\n\t\t\tinvtext,\n\t\t\tdebtortrans.rate,\n\t\t\tdecimalplaces\n\t\tFROM debtortrans INNER JOIN debtorsmaster\n\t\tON debtortrans.debtorno=debtorsmaster.debtorno\n\t\tINNER JOIN currencies\n\t\tON debtorsmaster.currcode=currencies.currabrev\n\t\tWHERE type='" . $_POST['TransType'] . "'\n\t\tAND date_format(inputdate, '%Y-%m-%d')='" . FormatDateForSQL($_POST['Date']) . "'";
$result = DB_query($sql, $db, '', '', false, false);
if (DB_error_no($db) != 0) {
    $Title = _('Payment Listing');
    include 'includes/header.inc';
    prnMsg(_('An error occurred getting the transactions'), 'error');
    if ($debug == 1) {
        prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br />' . $sql, 'error');
    }
    include 'includes/footer.inc';
    exit;
} elseif (DB_num_rows($result) == 0) {
    $Title = _('Payment Listing');
    include 'includes/header.inc';
    echo '<br />';
    prnMsg(_('There were no transactions found in the database for the date') . ' ' . $_POST['Date'] . '. ' . _('Please try again selecting a different date'), 'info');
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:PDFCustTransListing.php

示例13: prnMsg

     $i++;
 }
 if (mb_strlen($_POST['BankRef']) > 12) {
     $InputError = 1;
     prnMsg(_('The bank reference text must be less than 12 characters long'), 'error');
     $Errors[$i] = 'BankRef';
     $i++;
 }
 if (!Is_Date($_POST['SupplierSince'])) {
     $InputError = 1;
     prnMsg(_('The supplier since field must be a date in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
     $Errors[$i] = 'SupplierSince';
     $i++;
 }
 if ($InputError != 1) {
     $SQL_SupplierSince = FormatDateForSQL($_POST['SupplierSince']);
     //first off validate inputs sensible
     $sql = "SELECT COUNT(supplierid) FROM suppliers WHERE supplierid='" . $SupplierID . "'";
     $result = DB_query($sql, $db);
     $myrow = DB_fetch_row($result);
     $SuppExists = DB_num_rows($result) > 0;
     if ($SuppExists and $_POST['UpdateIfExists'] != 1) {
         $UpdatedNum++;
     } elseif ($SuppExists) {
         $UpdatedNum++;
         $supptranssql = "SELECT supplierno\n\t\t\t\t\t\t\t\tFROM supptrans\n\t\t\t\t\t\t\t\tWHERE supplierno='" . $SupplierID . "'";
         $suppresult = DB_query($supptranssql, $db);
         $supptrans = DB_num_rows($suppresult);
         $suppcurrssql = "SELECT currcode\n\t\t\t\t\t\t\t\tFROM suppliers\n\t\t\t\t\t\t\t\tWHERE supplierid='" . $SupplierID . "'";
         $currresult = DB_query($suppcurrssql, $db);
         $suppcurr = DB_fetch_row($currresult);
开发者ID:rrsc,项目名称:KwaMoja,代码行数:31,代码来源:Z_ImportSuppliers.php

示例14: submit

function submit(&$db, &$StockID, &$DemandID)
{
    // In this section if hit submit button. Do edit checks. If all checks pass, see if record already
    // exists for StockID/Duedate/MRPDemandtype combo; that means do an Update, otherwise, do INSERT.
    //initialise no input errors assumed initially before we test
    // echo "<br/>Submit - DemandID = $DemandID<br/>";
    $FormatedDuedate = FormatDateForSQL($_POST['Duedate']);
    $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_numeric($_POST['Quantity'])) {
        $InputError = 1;
        prnMsg(_('Quantity must be numeric'), 'error');
    }
    if ($_POST['Quantity'] <= 0) {
        $InputError = 1;
        prnMsg(_('Quantity must be greater than 0'), 'error');
    }
    if (!Is_Date($_POST['Duedate'])) {
        $InputError = 1;
        prnMsg(_('Invalid due date'), 'error');
    }
    $sql = "SELECT mrpdemandtype FROM mrpdemandtypes\n\t\t\t\tWHERE mrpdemandtype='" . $_POST['MRPDemandtype'] . "'";
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) == 0) {
        $InputError = 1;
        prnMsg(_('Invalid demand type'), 'error');
    }
    // Check if valid part number - Had done a Select Count(*), but that returned a 1 in DB_num_rows
    // even if there was no record.
    $sql = "SELECT stockid FROM stockmaster\n\t\t\t\tWHERE stockid='" . $StockID . "'";
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) == 0) {
        $InputError = 1;
        prnMsg($StockID . ' ' . _('is not a valid item code'), 'error');
        unset($_POST['StockID']);
        unset($StockID);
    }
    // Check if part number/demand type/due date combination already exists
    $sql = "SELECT stockid FROM mrpdemands\n\t\t\tWHERE stockid='" . $StockID . "'\n\t\t\t\tAND mrpdemandtype='" . $_POST['MRPDemandtype'] . "'\n\t\t\t\tAND duedate='" . $FormatedDuedate . "'\n\t\t\t\tAND demandid <> '" . $DemandID . "'";
    $result = DB_query($sql, $db);
    if (DB_num_rows($result) > 0) {
        $InputError = 1;
        prnMsg(_('Record already exists for part number/demand type/date'), 'error');
    }
    if ($InputError != 1) {
        $sql = "SELECT COUNT(*) FROM mrpdemands\n\t\t\t\t   WHERE demandid='" . $DemandID . "'\n\t\t\t\t   GROUP BY demandid";
        $result = DB_query($sql, $db);
        $myrow = DB_fetch_row($result);
        if ($myrow[0] > 0) {
            //If $myrow[0] > 0, it means this is an edit, so do an update
            $sql = "UPDATE mrpdemands SET quantity = '" . $_POST['Quantity'] . "',\n\t\t\t\t\t\t\tmrpdemandtype = '" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "',\n\t\t\t\t\t\t\tduedate = '" . $FormatedDuedate . "'\n\t\t\t\t\tWHERE demandid = '" . $DemandID . "'";
            $msg = _("The MRP demand record has been updated for") . ' ' . $StockID;
        } else {
            // If $myrow[0] from SELECT count(*) is zero, this is an entry of a new record
            $sql = "INSERT INTO mrpdemands (stockid,\n\t\t\t\t\t\t\tmrpdemandtype,\n\t\t\t\t\t\t\tquantity,\n\t\t\t\t\t\t\tduedate)\n\t\t\t\t\t\tVALUES ('" . $StockID . "',\n\t\t\t\t\t\t\t'" . trim(mb_strtoupper($_POST['MRPDemandtype'])) . "',\n\t\t\t\t\t\t\t'" . $_POST['Quantity'] . "',\n\t\t\t\t\t\t\t'" . $FormatedDuedate . "'\n\t\t\t\t\t\t)";
            $msg = _('A new MRP demand record has been added to the database for') . ' ' . $StockID;
        }
        $result = DB_query($sql, $db, _('The update/addition of the MRP demand record failed because'));
        prnMsg($msg, 'success');
        echo '<br />';
        unset($_POST['MRPDemandtype']);
        unset($_POST['Quantity']);
        unset($_POST['StockID']);
        unset($_POST['Duedate']);
        unset($StockID);
        unset($DemandID);
    }
    // End of else where DB_num_rows showed there was a valid stockmaster record
    display($db, $StockID, $DemandID);
}
开发者ID:patmark,项目名称:weberp-elct,代码行数:72,代码来源:MRPDemands.php

示例15: _

echo '<tr><td colspan="2"></td>';
echo '<td>' . _('Total For') . ' ' . $DayNames[DayOfWeekFromSQLDate(DateAdd($LastDate, 'd', -1))] . ' ' . DateAdd(ConvertSQLDate($LastDate), 'd', 0) . '</td>';
echo '<td class="number">' . $SubTotalQuantity . '</td>';
echo '<td class="number">' . number_format($SubTotalValue, $_SESSION['Currencies'][$_SESSION['CompanyRecord']['currencydefault']]['DecimalPlaces']) . '</td></tr>';
echo '<tr><th colspan="5"></th></tr>';
echo '<tr><th colspan="5"></th></tr>';
echo '<tr><td colspan="2"></td>';
echo '<td><b>' . 'Total' . '</b></td>';
echo '<td class="number"><b>' . $TotalQuantity . '</b></td>';
echo '<td class="number"><b>' . number_format($TotalValue, $_SESSION['Currencies'][$_SESSION['CompanyRecord']['currencydefault']]['DecimalPlaces']) . '</b></td></tr>';
echo '<tr><th colspan="5"></th></tr>';
echo '</table>';
echo '</td>';
echo '<td width="33%" style="text-align: left;vertical-align: top;">';
echo '<table width="100%" class="selection">';
$sql = "SELECT stockmoves.stockid,\n\t\t\t\tstockmaster.description,\n\t\t\t\tsum(-qty*price) AS value\n\t\t\tFROM stockmoves\n\t\t\tLEFT JOIN stockmaster\n\t\t\tON stockmaster.stockid=stockmoves.stockid\n\t\t\tLEFT JOIN stockcategory\n\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\tWHERE stockcategory.stocktype='X'\n\t\t\t\tAND stockmoves.trandate='" . FormatDateForSQL($_POST['ReportDate']) . "'\n\t\t\tGROUP BY stockmoves.stockid";
$result = DB_query($sql, $db);
while ($myrow = DB_fetch_array($result)) {
    $Point1[] = $myrow['value'];
    $Point2[] = $myrow['stockid'];
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($Point1, "Serie1");
$DataSet->AddPoint($Point2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(420, 250);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:KCMCRadiologyReport.php


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