コード例 #1
0
ファイル: FormMaker.php プロジェクト: ellymakuba/AIRADS
            }
            $title = RPT_CRITERIA;
            $IncludePage = 'forms/FormsFilter.html';
        } else {
            // return to the form list page
            $OutputString = BuildFormList($_GET['id']);
            $title = RPT_FORMSELECT;
            $IncludePage = 'forms/FormsList.html';
        }
        break;
}
// end switch 'todo'
include $PathPrefix . 'includes/header.inc';
if ($usrMsg) {
    foreach ($usrMsg as $temp) {
        prnmsg($temp['message'], $temp['level']);
    }
}
include $IncludePage;
include $PathPrefix . 'includes/footer.inc';
// End main body
// Begin functions
function BuildFormList($GroupID)
{
    global $db, $ReportGroups, $FormGroups;
    $OutputString = '';
    if ($GroupID == '') {
        // then fetchthe complete form list for all groups
        foreach ($ReportGroups as $key => $GName) {
            $OutputString .= '<tr bgcolor="#CCCCCC"><td colspan="3" align="center">' . $GName . '</td></tr>';
            $OutputString .= '<tr><td colspan="3" width="250" valign="top">';
コード例 #2
0
            $RecurrOrderNo = DB_Last_Insert_ID($db, 'recurringsalesorders', 'recurrorderno');
            echo 'xxx' . $RecurrOrderNo;
            $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tstkcode,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tunitprice,\n\t\t\t\t\t\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\t\t\t\t\t\tdiscountpercent,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tnarrative)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tVALUES ('";
            foreach ($_SESSION['Items' . $identifier]->LineItems as $StockItem) {
                $LineItemsSQL = $StartOf_LineItemsSQL . $RecurrOrderNo . "',\n\t\t\t\t\t\t\t\t'" . $StockItem->StockID . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->Price) . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->Quantity) . "',\n\t\t\t\t\t\t\t\t'" . filter_number_format($StockItem->DiscountPercent) . "',\n\t\t\t\t\t\t\t\t'" . $StockItem->Narrative . "')";
                $Ins_LineItemResult = DB_query($LineItemsSQL, $ErrMsg, $DbgMsg, true);
            }
            /* inserted line items into sales order details */
            $result = DB_Txn_Commit();
            prnmsg(_('The new recurring order template has been added'), 'success');
        } else {
            /* must be updating an existing recurring order */
            $HeaderSQL = "UPDATE recurringsalesorders SET\n\t\t\t\t\t\tstopdate =  '" . FormatDateforSQL($_POST['StopDate']) . "',\n\t\t\t\t\t\tfrequency = '" . $_POST['Frequency'] . "',\n\t\t\t\t\t\tautoinvoice = '" . $_POST['AutoInvoice'] . "'\n\t\t\t\t\tWHERE recurrorderno = '" . $_POST['ExistingRecurrOrderNo'] . "'";
            $ErrMsg = _('The recurring order cannot be updated because');
            $UpdateQryResult = DB_query($HeaderSQL, $ErrMsg);
            prnmsg(_('The recurring order template has been updated'), 'success');
        }
        echo '<p><a href="' . $RootPath . '/SelectOrderItems.php?NewOrder=Yes">' . _('Enter New Sales Order') . '</a>';
        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;
    }
}
echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/customer.png" title="' . _('Search') . '" alt="" /><b>' . ' ' . _('Recurring Order for Customer') . ' : ' . $_SESSION['Items' . $identifier]->CustomerName . '</b></p>';
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '" method="post">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table cellpadding="2" class="selection">';
echo '<tr><th colspan="7"><b>' . _('Order Line Details') . '</b></th></tr>';
コード例 #3
0
				<td>' . _('Phone no') . '</td><td><input type="text" name="phoneno" value="' . $_POST['phoneno'] . '"></td></tr><tr>
				<td>' . _('Notes') . '</td><td><textarea name="notes">' . $_POST['notes'] . '</textarea></td></tr>
				<tr><td colspan=2><div class="centre"><button type="submit" name="update">' . _('Update') . '</td></tr></table>';
    }
    if (isset($_POST['update'])) {
        $SQLupdatecc = "UPDATE custcontacts\n\t\t\t\t\t\tSET contactname='" . $_POST['custname'] . "',\n\t\t\t\t\t\trole='" . $_POST['role'] . "',\n\t\t\t\t\t\tphoneno='" . $_POST['phoneno'] . "',\n\t\t\t\t\t\tnotes='" . DB_escape_string($_POST['notes']) . "'\n\t\t\t\t\t\tWhere debtorno='" . $DebtorNo . "'\n\t\t\t\t\t\tand contid='" . $Edit . "'";
        $resultupcc = DB_query($SQLupdatecc, $db);
        echo '<br />' . $SQLupdatecc;
        echo '<meta http-equiv="Refresh" content="0; url="' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo . '&ID=' . $ID . '">';
    }
    if (isset($_GET['delete'])) {
        $SQl = "DELETE FROM custcontacts where debtorno='" . $DebtorNo . "'\n\t\t\t\tand contid='" . $ID . "'";
        $resultupcc = DB_query($SQl, $db);
        echo '<meta http-equiv="Refresh" content="0; url=' . $_SERVER['PHP_SELF'] . '?DebtorNo=' . $DebtorNo . '">';
        echo '<br />' . $SQl;
        prnmsg('Contact Deleted', 'success');
    }
    echo '</td></tr></table>';
    // end of main ifs
}
if (!isset($DebtorNo)) {
    echo '<br /><div class="centre">
			<button type="submit" name="submit">' . _('Add New Company') . '</button>&nbsp;
			<button type=submit name="reset">' . _('Reset') . '</button></div>';
    echo '<input type="hidden" name="New" value="True" />';
} else {
    echo '<br /><div class="centre"><button type="submit" name="submit">' . _('Update Company') . '</button>';
    echo '&nbsp;<button type="submit" name="delete" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete Company') . '</button>';
}
if (isset($_POST['addcontact']) and isset($_POST['addcontact']) != '') {
    echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/AddCustomerContacts.php?DebtorNo=' . $DebtorNo . '">';
コード例 #4
0
    //run the SQL from either of the above possibilites
    if (isset($InputError) and $InputError != 1) {
        unset($_POST['TaxGLCode']);
        unset($_POST['PurchTaxGLCode']);
        unset($_POST['Description']);
        unset($SelectedTaxID);
    }
    prnMsg($msg);
} elseif (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked instead of the submit button
    // PREVENT DELETES IF DEPENDENT RECORDS IN OTHER TABLES
    $sql = "SELECT COUNT(*)\n\t\t\tFROM taxgrouptaxes\n\t\tWHERE taxauthid='" . $SelectedTaxAuthID . "'";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    if ($myrow[0] > 0) {
        prnmsg(_('Cannot delete this tax authority because there are tax groups defined that use it'), 'warn');
    } else {
        /*Cascade deletes in TaxAuthLevels */
        $result = DB_query("DELETE FROM taxauthrates WHERE taxauthority= '" . $SelectedTaxAuthID . "'", $db);
        $result = DB_query("DELETE FROM taxauthorities WHERE taxid= '" . $SelectedTaxAuthID . "'", $db);
        prnMsg(_('The selected tax authority record has been deleted'), 'success');
        unset($SelectedTaxAuthID);
    }
    // end of related records testing
}
if (!isset($SelectedTaxAuthID)) {
    /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTaxAuthID will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of tax authorities will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/
    $sql = "SELECT taxid,\n\t\t\t\tdescription,\n\t\t\t\ttaxglcode,\n\t\t\t\tpurchtaxglaccount,\n\t\t\t\tbank,\n\t\t\t\tbankacc,\n\t\t\t\tbankacctype,\n\t\t\t\tbankswift\n\t\t\tFROM taxauthorities";
    $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The defined tax authorities could not be retrieved because');
    $DbgMsg = _('The following SQL to retrieve the tax authorities was used');
    $result = DB_query($sql, $db, $ErrMsg, $DbgMsg);
コード例 #5
0
                     $PurchItems[$StockID]['DeliveryDate'] = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $LeadTime);
                 } else {
                     // no purchasing data setup
                     $PurchItems[$StockID]['Price'] = 0;
                     $PurchItems[$StockID]['ConversionFactor'] = 1;
                     $PurchItems[$StockID]['SupplierDescription'] = $ItemRow['description'];
                     $PurchItems[$StockID]['UnitOfMeasure'] = $ItemRow['units'];
                     $PurchItems[$StockID]['SuppliersPartNo'] = 'each';
                     $LeadTime = 1;
                     $PurchItems[$StockID]['DeliveryDate'] = Date($_SESSION['DefaultDateFormat']);
                 }
                 $OrderValue += $PurchItems[$StockID]['Quantity'] * $PurchItems[$StockID]['Price'];
             } else {
                 //item could not be found
                 $InputError = 1;
                 prnmsg(_('An item where a quantity was entered could not be retrieved from the database. The order cannot proceed. The item code was:') . ' ' . $StockID, 'error');
             }
         }
         //end if the quantity entered into the form is positive
     }
     //end if the form variable name is OrderQtyXXX
 }
 //end loop around the form variables
 if ($InputError == 0) {
     //only if all continues smoothly
     $sql = "SELECT suppliers.suppname,\n\t\t\t\t\t\tsuppliers.currcode,\n\t\t\t\t\t\tcurrencies.decimalplaces,\n\t\t\t\t\t\tcurrencies.rate,\n\t\t\t\t\t\tsuppliers.paymentterms,\n\t\t\t\t\t\tsuppliers.address1,\n\t\t\t\t\t\tsuppliers.address2,\n\t\t\t\t\t\tsuppliers.address3,\n\t\t\t\t\t\tsuppliers.address4,\n\t\t\t\t\t\tsuppliers.address5,\n\t\t\t\t\t\tsuppliers.address6,\n\t\t\t\t\t\tsuppliers.telephone\n\t\t\t\tFROM suppliers INNER JOIN currencies\n\t\t\t\tON suppliers.currcode=currencies.currabrev\n\t\t\t\tWHERE supplierid='" . $_POST['Supplier'] . "'";
     $SupplierResult = DB_query($sql, $db);
     $SupplierRow = DB_fetch_array($SupplierResult);
     $sql = "SELECT deladd1,\n\t\t\t\t\t\t\tdeladd2,\n\t\t\t\t\t\t\tdeladd3,\n\t\t\t\t\t\t\tdeladd4,\n\t\t\t\t\t\t\tdeladd5,\n\t\t\t\t\t\t\tdeladd6,\n\t\t\t\t\t\t\ttel,\n\t\t\t\t\t\t\tcontact\n\t\t\t\t\t\tFROM locations\n\t\t\t\t\t\tWHERE loccode='" . $_SESSION['UserStockLocation'] . "'";
     $LocnAddrResult = DB_query($sql, $db);
     if (DB_num_rows($LocnAddrResult) == 1) {