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


PHP remval函数代码示例

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


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

示例1: showCalendar_month

function showCalendar_month()
{
    global $_GET;
    extract($_GET);
    // check diary view permissions
    if (!isset($view_diary) || $view_diary == USER_NAME) {
        $view_diary = USER_NAME;
    } else {
        // make sure user has read privileges on this diary
        $view_diary = remval($view_diary);
        db_conn("cubit");
        $sql = "SELECT * FROM diary_privileges\r\n\t\t\tWHERE priv_owner='" . USER_NAME . "' AND diary_owner='{$view_diary}' AND privilege='R'";
        $rslt = db_exec($sql) or errDie("Error reading diary diary privileges.");
        if (pg_num_rows($rslt) < 1) {
            return "<li class=err>You do not have sufficient permissions to read this diary.</li>";
        }
    }
    if (!isset($month)) {
        $month = date("m");
    }
    if (!isset($year)) {
        $year = date("Y");
    }
    $monthview = generateMonthView_large($month, $year, $view_diary);
    $OUTPUT = "\r\n\t<table width='750'>\r\n\t<tr>\r\n\t\t<td align=center valign=top>{$monthview}</td>\r\n\t</tr>\r\n\t</table>";
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:27,代码来源:diary-month.php

示例2: OUTPUT

function OUTPUT($_POST)
{
    extract($_POST);
    $typeid = remval($typeid);
    # Set up table to display in
    $OUTPUT .= "<td valign=top width='33%'>\r\n<table border=0 width='90%'>\r\n<tr><td align=center nowrap><h3>Document Data</h3></td></tr>\r\n<tr><th>Type</th><th>Ref</th><th>Document</th><th>Date</th><th>Description</th><th>Filename</th></tr>";
    if ($typeid != '0') {
        $whe = "AND typeid='{$typeid}' ";
    } else {
        $whe = "";
    }
    # Connect to database
    //db_conn (YR_DB);
    db_conn("yr2");
    # Query server
    $i = 0;
    $sql = "SELECT * FROM documents WHERE div = '" . USER_DIV . "' {$whe} ORDER BY docname ASC";
    $docRslt = db_exec($sql) or errDie("Unable to retrieve Documents from database.");
    if (pg_numrows($docRslt) < 1) {
        return "<li>There are no Documents in Cubit.</li>\r\n\t\t\t <p>\r\n\t\t\t <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docadd.php'>Add Document</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docview.php'>View Documents</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docman-index.php'>Back</a></td></tr>\r\n\t\t</table>";
    }
    while ($doc = pg_fetch_array($docRslt)) {
        $OUTPUT .= "<tr class='" . bg_class() . "'><td>{$doc['typename']}</td><td>{$doc['docref']}</td><td>{$doc['docname']}</td><td>{$doc['docdate']}</td><td>{$doc['descrip']}</td><td>{$doc['filename']}</td><td><a href='docedit.php?docid={$doc['docid']}'>Edit</a></td>";
        $OUTPUT .= "<td><a href='docdload.php?docid={$doc['docid']}'>Download</a></td><td><a href='docrem.php?docid={$doc['docid']}'>Remove</a></td></tr>";
        $i++;
    }
    $OUTPUT .= "</table></td>";
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:test-index.php

示例3: settings

function settings()
{
    extract($_POST);
    db_conn('cubit');
    $err = "";
    $save = false;
    if (isset($from)) {
        $save = true;
        require_lib("validate");
        $v = new validate();
        $v->isOk($sig, "string", 0, 255, "Invalid signature.");
        $v->isOk($from, "email", 1, 255, "Invalid from e-mail address.");
        $v->isOk($reply, "email", 0, 255, "Invalid reply e-mail address.");
        $v->isOk($host, "string", 1, 255, "Invalid smtp server. You need to fill in the SMTP HOST field, you can get this from your ISP.<br>\n\t\t\t\tExamples: smtp.saix.net OR smtp.mweb.co.za");
        if ($v->isError()) {
            $err = $v->genErrors();
        } else {
            $sig = remval($sig);
            $from = remval($from);
            $reply = remval($reply);
            $host = remval($host);
            $Sl = "SELECT * FROM esettings";
            $Ri = db_exec($Sl);
            if (pg_num_rows($Ri) < 1) {
                $Sl = "INSERT INTO esettings(sig,fromname,reply,smtp_host,smtp_auth,smtp_user,smtp_pass) VALUES\n\t\t\t\t('{$sig}','{$from}','{$reply}','{$host}','0','','')";
                $Ri = db_exec($Sl);
            } else {
                $Sl = "UPDATE esettings SET sig='{$sig}',fromname='{$from}',reply='{$reply}',smtp_host='{$host}'";
                $Ri = db_exec($Sl);
            }
            r2sListRestore("emailsettings");
        }
    }
    $Sl = "SELECT * FROM esettings";
    $Ri = db_exec($Sl);
    $sd = pg_fetch_array($Ri);
    if (!$save) {
        $ex = "<li class=err>Please set your email settings & then click 'Update'</li>";
    } else {
        $ex = "<li class=err>Email settings saved</li>";
    }
    if (pg_num_rows($Ri) < 1) {
        $sd['sig'] = "";
        $sd['fromname'] = "";
        $sd['reply'] = "";
        $sd['smtp_host'] = "smtp.saix.net";
        $exx = "<li class=err>These are default settings. If these settings do not work, contact your ISP for correct details.</li>";
    } else {
        $exx = "";
    }
    $sd = array_merge($sd, $_POST);
    if (!isset($retdata)) {
        $retdata = "";
    }
    $out = "<h3>Email Settings</h3>\n\t{$exx}\n\t{$ex}\n\t<br />\n\t{$err}\n\t<table " . TMPL_tblDflts . ">\n\t<form action='" . SELF . "' method=post>\n\t{$retdata}\n\t<tr>\n\t\t<th colspan='2'>Settings</th>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td align='center' colspan='2'><b>An asterisk (" . REQ . ") symbol marks required fields.</b></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Signature</td>\n\t\t<td><input type='text' size='25' name='sig' value='{$sd['sig']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>" . REQ . " From E-mail Address</td>\n\t\t<td><input type='text' size='25' name='from' value='{$sd['fromname']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>Reply To E-mail Address</td>\n\t\t<td><input type='text' size='25' name='reply' value='{$sd['reply']}'></td>\n\t</tr>\n\t<tr class='" . bg_class() . "'>\n\t\t<td>" . REQ . " SMTP Server</td>\n\t\t<td><input type='text' size='25' name='host' value='{$sd['smtp_host']}'></td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align=right><input type=submit value='Update &raquo;'></td>\n\t</tr>\n\t</form>\n\t</table>\n\t<p>\n\t<table boder=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<tr><th>Quick Links</th></tr>\n\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\n\t</table>";
    return $out;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:57,代码来源:email-settings.php

示例4: write

function write($_POST)
{
    # get vars
    extract($_POST);
    $terms = remval($terms);
    if (strlen($terms) > 1024) {
        return "<h3>Company Terms Too Long</h3>";
    }
    db_connect();
    $sql = "UPDATE compinfo SET terms = '{$terms}'";
    $allow = db_exec($sql) or errDie("Unable To Update Company Terms");
    return "\r\n\t\t\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<td><h3>Company Terms have been Successfully Updated</h3></h3></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<p>\r\n\t\t\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t<th>Quick Links</th>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t\t\t</table>";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:13,代码来源:company-terms.php

示例5: slct

function slct($err = "")
{
    global $_POST;
    extract($_POST);
    if (isset($letters)) {
        $letters = remval($letters);
        $whe = "AND lower(surname) LIKE lower('%{$letters}%')";
    } else {
        $letters = "";
        $whe = "";
    }
    db_connect();
    $sql = "SELECT * FROM customers WHERE div = '" . USER_DIV . "' AND location != 'int' {$whe} ORDER BY lower(surname) ASC";
    $cusRslt = db_exec($sql) or errDie("Could not retrieve Customers Information from the Database.", SELF);
    $custs = "<select name='sval'>";
    if (pg_numrows($cusRslt) < 1) {
        $custs .= "<option value='-S'></option>";
    }
    while ($cus = pg_fetch_array($cusRslt)) {
        $custs .= "<option value='{$cus['cusnum']}'>{$cus['surname']}</option>";
    }
    $custs .= "</select>";
    $sql = "SELECT * FROM bankacct WHERE btype != 'int' AND div = '" . USER_DIV . "'";
    $Rs = db_exec($sql);
    $numrows = pg_numrows($Rs);
    if (empty($numrows)) {
        return "<li class='err'> There are no accounts held at the selected Bank.</li>\n\t\t<p><input type='button' onClick='JavaScript:history.back();' value='&laquo; Correct Selection'>";
    }
    $banks = "<select name='bankid'>";
    while ($acc = pg_fetch_array($Rs)) {
        $banks .= "<option value={$acc['bankid']}>{$acc['accname']} - {$acc['bankname']} ({$acc['acctype']})</option>";
    }
    $banks .= "</select>";
    db_conn("exten");
    $sql = "SELECT * FROM departments WHERE div = '" . USER_DIV . "' ORDER BY deptname ASC";
    $deptRslt = db_exec($sql);
    $depts = "<select name='cval'>";
    if (pg_numrows($deptRslt) < 1) {
        $depts .= "<option value='-S'></option>";
    }
    while ($dept = pg_fetch_array($deptRslt)) {
        $depts .= "<option value='{$dept['deptid']}'>{$dept['deptname']}</option>";
    }
    $depts .= "</select>";
    //<tr class='bg-odd' ".ass("Select when the sale of non stock goods is a bank sale")."><td><input type=radio name=ctyp value='cb'>Bank Sale</td><td>$banks</td></tr>
    $details = "\n\t\t<center>\n\t\t<h3>New Recurring Non-Stock Invoice</h3>\n\t\t<h4>Customer Details</h4>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='slct'>\n\t\t\t<input type='hidden' name='starting' value=''>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<td colspan='2'>{$err}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'> Invoice Details </th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "' " . ass("Select when selling non stock goods to your customers") . ">\n\t\t\t\t<td><input type='radio' name='ctyp' value='s' checked='yes'> Select Customer</td>\n\t\t\t\t<td>{$custs}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "' " . ass("Select when the sale of non stock goods is a cash sale") . ">\n\t\t\t\t<td><input type='radio' name='ctyp' value='c'>Cash Sale</td>\n\t\t\t\t<td>{$depts}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "' " . ass("Select when the sale of non stock goods is not a cash sale") . ">\n\t\t\t\t<td><input type='radio' name='ctyp' value='ac'>Ledger Accounts Sale</td>\n\t\t\t\t<td></td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Search by surname</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><input type='text' size='10' name='letters' value='{$letters}'></td>\n\t\t\t\t<td><input type='submit' value='Search &raquo;'></td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td align='center'></td>\n\t\t\t\t<td align='center'><input type='submit' name='button' value='Continue &raquo;'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
    return $details;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:48,代码来源:rec-nons-invoice-new.php

示例6: confirm

function confirm($_GET)
{
    extract($_GET);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($from_day, "num", 1, 2, "Invalid from Date day.");
    $v->isOk($from_month, "num", 1, 2, "Invalid from Date month.");
    $v->isOk($from_year, "num", 1, 4, "Invalid from Date Year.");
    $v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
    $v->isOk($body, "string", 1, 800, "Invalid to Email Message.");
    # mix dates
    $fromdate = $from_year . "-" . $from_month . "-" . $from_day;
    $todate = $to_year . "-" . $to_month . "-" . $to_day;
    if (!checkdate($from_month, $from_day, $from_year)) {
        $v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
    }
    if (!checkdate($to_month, $to_day, $to_year)) {
        $v->isOk($todate, "num", 1, 1, "Invalid to date.");
    }
    $type = remval($type);
    # display errors, if any
    $err = "";
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return $err;
    }
    $out = "\n\t\t\t<h3>Statements to be e-mailed: {$fromdate} TO {$todate}, {$type}</h3>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='send'>\n\t\t\t\t<input type='hidden' name='from_day' value='{$from_day}'>\n\t\t\t\t<input type='hidden' name='from_month' value='{$from_month}'>\n\t\t\t\t<input type='hidden' name='from_year' value='{$from_year}'>\n\t\t\t\t<input type='hidden' name='to_day' value='{$to_day}'>\n\t\t\t\t<input type='hidden' name='to_month' value='{$to_month}'>\n\t\t\t\t<input type='hidden' name='to_year' value='{$to_year}'>\n\t\t\t\t<input type='hidden' name='type' value='{$type}'>\n\t\t\t\t<input type='hidden' name='body' value='{$body}'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Acc Num</th>\n\t\t\t\t\t<th>Customer</th>\n\t\t\t\t\t<th>Email Address</th>\n\t\t\t\t</tr>";
    $i = 0;
    db_conn('cubit');
    foreach ($cids as $id) {
        $id += 0;
        $Sl = "SELECT accno,surname,email FROM customers WHERE cusnum='{$id}'";
        $Ri = db_exec($Sl);
        $cd = pg_fetch_array($Ri);
        $out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>{$cd['accno']}</td>\n\t\t\t\t\t<td>{$cd['surname']}</td>\n\t\t\t\t\t<td>{$email[$id]}</td>\n\t\t\t\t</tr>\n\t\t\t\t<input type='hidden' name='cids[]' value='{$id}'>\n\t\t\t\t<input type='hidden' name='email[{$id}]' value='{$email[$id]}'>";
        $i++;
    }
    $out .= "\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<th colspan='3'>Message That Will Display In The Email</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='3'>" . nl2br($body) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><input type='submit' name='back' value='&laquo Correction'></td>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Send Emails &raquo;'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>";
    return $out;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:46,代码来源:statements-email.php

示例7: showCalendar_day

function showCalendar_day()
{
    global $_GET;
    // get the post_vars
    extract($_GET);
    // create the day view and month view data
    if (!isset($view_diary) || $view_diary == USER_NAME) {
        $view_diary = USER_NAME;
    } else {
        // make sure user has read privileges on this diary
        $view_diary = remval($view_diary);
        db_conn("cubit");
        $sql = "SELECT * FROM diary_privileges\r\n\t\t\tWHERE priv_owner='" . USER_NAME . "' AND diary_owner='{$view_diary}' AND privilege='R'";
        $rslt = db_exec($sql) or errDie("Error reading diary diary privileges.");
        if (pg_num_rows($rslt) < 1) {
            return "<li class=err>You do not have sufficient permissions to read this diary.</li>";
        }
    }
    $DayView = createDayView($mday, $month, $year, $view_diary);
    $MonthViews = createMonthViews($month, $year, $view_diary);
    $Notices = createNotices($mday, $month, $year, $view_diary);
    $OUTPUT = "\r\n\t<center><table width='750'>\r\n\t\t<tr>\r\n\t\t\t<td width=550 valign=top>\r\n\t\t\t\t{$DayView}\r\n\t\t\t</td>\r\n\t\t\t<td width=200 valign=top>\r\n\t\t\t\t{$MonthViews}\r\n\t\t\t\t<hr>\r\n\t\t\t\t{$Notices}\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table></center>\r\n\t";
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:24,代码来源:diary-day.php

示例8: write


//.........这里部分代码省略.........
            $discp[$keys] += 0;
            $disc[$keys] += 0;
            $v->isOk($qty, "num", 1, 10, "Invalid Quantity for product number : <b>" . ($keys + 1) . "</b>");
            $v->isOk($disc[$keys], "float", 0, 20, "Invalid Discount for product number : <b>" . ($keys + 1) . "</b>.");
            if ($disc[$keys] > $unitcost[$keys]) {
                $v->isOk($disc[$keys], "float", 0, 0, "Error : Discount for product number : <b>" . ($keys + 1) . "</b> is more than the unitcost.");
            }
            $v->isOk($discp[$keys], "float", 0, 20, "Invalid Discount Percentage for product number : <b>" . ($keys + 1) . "</b>.");
            $v->isOk($unitcost[$keys], "float", 1, 20, "Invalid Unit Price for product number : <b>" . ($keys + 1) . "</b>.");
            if ($qty < 1) {
                $v->isOk($qty, "num", 0, 0, "Error : Item Quantity must be at least one. Product number : <b>" . ($keys + 1) . "</b>");
            }
        }
    }
    # check whids
    if (isset($whids)) {
        foreach ($whids as $keys => $whid) {
            $v->isOk($whid, "num", 1, 10, "Invalid Store number, please enter all details.");
        }
    }
    $cusnum += 0;
    # check stkids
    if (isset($stkids)) {
        foreach ($stkids as $keys => $stkid) {
            $v->isOk($stkid, "num", 1, 10, "Invalid Stock number, please enter all details.");
        }
    }
    # check amt
    if (isset($amt)) {
        foreach ($amt as $keys => $amount) {
            $v->isOk($amount, "float", 1, 20, "Invalid Amount, please enter all details.");
        }
    }
    $des = remval($des);
    # display errors, if any
    $err = "";
    if ($v->isError()) {
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $err .= "<li class=err>" . $e["msg"];
        }
        return details($_POST, $err);
    }
    if (strlen($client) < 1) {
        $client = "Cash Sale";
    }
    if (strlen($vatnum) < 1) {
        $vatnum = "";
    }
    $_POST['client'] = $client;
    $_POST['vatnum'] = $vatnum;
    $_POST['telno'] = $telno;
    $_POST['cordno'] = $cordno;
    # Get invoice info
    db_connect();
    $sql = "SELECT * FROM pinvoices WHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $invRslt = db_exec($sql) or errDie("Unable to get invoice information");
    if (pg_numrows($invRslt) < 1) {
        return "<li>- Invoice Not Found</li>";
    }
    $inv = pg_fetch_array($invRslt);
    $inv['traddisc'] = $traddisc;
    $inv['chrgvat'] = $chrgvat;
    # check if invoice has been printed
    if ($inv['printed'] == "y") {
        $error = "<li class='err'> Error : Invoice number <b>{$invid}</b> has already been printed.</li>";
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:67,代码来源:pos-invoice-new-no-neg.php

示例9: write_data

function write_data($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = remval($value);
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    # display errors, if any
    if ($v->isError()) {
        $confirmCust = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirmCust .= "<li class=err>" . $e["msg"];
        }
        return $confirmCust;
    }
    db_conn('cubit');
    pglib_transaction("begin");
    $h = 0;
    $datemade = date("Y-m-d");
    $datefor = $date;
    $userfor = USER_NAME;
    $Sl = "DELETE FROM die WHERE datefor='{$datefor}' AND userfor='global'";
    $Rs = db_exec($Sl) or errDie("Unable to access database.");
    while ($h < 24) {
        if ($h < 10) {
            $h = "0" . $h;
        }
        $m = 0;
        while ($m < 60) {
            if ($m == 0) {
                $m = "00";
            }
            $t = "{$h}" . "{$m}";
            $tt = ${$t};
            $time = $t;
            $des = $tt;
            if (strlen($des) > 0) {
                $rem_date = substr($remops[$t], 0, 10);
                $rem_time = substr($remops[$t], 11, 4);
                //print "date: $rem_date time: $rem_time<br>";
                $Sl = "INSERT INTO die (datemade,datefor,userfor,time,des,remop,remdate,remtime,rem) VALUES ('{$datemade}','{$datefor}','global','{$time}','{$des}','{$rem_Options[$t]}','{$rem_date}','{$rem_time}','0')";
                $Rs = db_exec($Sl) or errDie("Unable to access database.");
            }
            $m = $m + 30;
        }
        $h++;
    }
    pglib_transaction("commit");
    header("Location: glodiary.php");
    exit;
    $write_data = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t <tr><th>Diary modified</th></tr>\r\n\t <tr class=datacell><td>Diary has been modified.</td></tr>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t <tr><th>Quick Links</th></tr>\r\n\t <tr class='bg-odd'><td><a href='glodiary.php'>Global Diary</a></td></tr>\r\n\t <tr class='bg-odd'><td><a href='index_die.php'>Diary</td>\r\n\t <tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $write_data;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:56,代码来源:glodiary-day.php

示例10: seltoken

function seltoken()
{
    global $_POST;
    extract($_POST);
    if (!isset($name)) {
        $name = "";
    }
    if (!isset($subject)) {
        $subject = "";
    }
    if (!isset($notes)) {
        $notes = "";
    }
    $name = remval($name);
    $subject = remval($subject);
    $notes = remval($notes);
    $whe = "";
    $csc = 0;
    if (!isset($team)) {
        $team = 0;
        $user = 0;
        $cat = 0;
        $csc = 0;
    } else {
        $team += 0;
        $user += 0;
        $cat += 0;
        $csc += 0;
    }
    if ($team == 0) {
        db_conn('crm');
        $Sl = "SELECT teamid FROM crms WHERE userid='" . USER_ID . "'";
        $Ri = db_exec($Sl) or errDie("Unable to get data.");
        $crmdata = pg_fetch_array($Ri);
        $team = $crmdata['teamid'];
    }
    if ($team != 0) {
        $whe .= " AND teamid='{$team}' ";
    }
    if ($user != 0) {
        $whe .= " AND userid='{$user}' ";
    }
    if ($cat != 0) {
        $whe .= " AND catid='{$cat}' ";
    }
    if ($csc != 0) {
        if ($csc == 1) {
            $whe .= " AND csct='Contact' ";
        } elseif ($csc == 2) {
            $whe .= " AND csct='Customer' ";
        } elseif ($csc == 3) {
            $whe .= " AND csct='Supplier' ";
        }
    }
    if (strlen($name) > 0) {
        $whe .= " AND lower(name) LIKE lower('%{$name}%') ";
    }
    if (strlen($subject) > 0) {
        $whe .= " AND lower(sub) LIKE lower('%{$subject}%') ";
    }
    if (strlen($notes) > 0) {
        $whe .= " AND lower(notes) LIKE lower('%{$notes}%') ";
    }
    $date = date("Y-m-d");
    db_conn('crm');
    $Sl = "SELECT * FROM crms WHERE userid='" . USER_ID . "'";
    $Ry = db_exec($Sl) or errDie("Unable to get info from db.");
    if (pg_numrows($Ry) < 1) {
        return "You have not been set up to use query management.<br>\r\n\t\tPlease allocate yourself to a team.\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='crms-allocate.php'>Allocate users to Teams</a></td></tr>\r\n\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t<tr class='bg-odd'><td><a href='index.php'>My Business</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
    }
    $crmdata = pg_fetch_array($Ry);
    if ($crmdata['teamid'] == 0) {
        return "You have not been set up to use query management.<br>\r\n\t\tPlease allocate yourself to a team.\r\n\t\t<p>\r\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='crms-allocate.php'>Allocate users to Teams</a></td></tr>\r\n\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t<tr class='bg-odd'><td><a href='index.php'>My Business</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t</table>";
    }
    $Sl = "SELECT * FROM teams WHERE id='{$team}'";
    $Ry = db_exec($Sl) or errDie("Unable to get team data.");
    $teamdata = pg_fetch_array($Ry);
    $username = USER_NAME;
    $disdate = date("d-m-Y, l, G:i");
    $i = 0;
    $Sl = "SELECT * FROM teamlinks WHERE team='{$team}' ORDER BY num";
    $Ry = db_exec($Sl) or errDie("Unable to get teamlinks from system.");
    if (pg_numrows($Ry) < 1) {
        $teamlinks = "<tr><td>There are no links for this team. Select links under settings, view teams.</td></tr><tr><th>Quick Links</th></tr>\r\n                <tr class='bg-odd'><td align=center><a href='team-links.php?id={$crmdata['teamid']}'>Select Team Links</a></td></tr>";
    } else {
        $teamlinks = "";
        while ($linkdata = pg_fetch_array($Ry)) {
            $i++;
            $teamlinks .= "<tr class='" . bg_class() . "'><td><a target=_blank href='{$linkdata['script']}'>{$linkdata['name']}</a></td></tr>";
        }
    }
    $i = 0;
    $tokens = "";
    $Sl = "SELECT id,sub,name FROM tokens WHERE userid='" . USER_ID . "' {$whe} ORDER BY id";
    $Ry = db_exec($Sl) or errDie("Unable to get queries from db.");
    while ($tokendata = pg_fetch_array($Ry)) {
        $i++;
        $tokens .= "<tr class='" . bg_class() . "'><td>{$tokendata['id']}</td><td>{$tokendata['name']} - {$tokendata['sub']}</td><td><a href='tokens-manage.php?id={$tokendata['id']}'>Open</a></td></tr>";
    }
    $Sl = "SELECT id,name,username,sub,lastdate,opendate FROM tokens WHERE nextdate<='{$date}' {$whe} ORDER BY id";
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:tokens-manage.php

示例11: write


//.........这里部分代码省略.........
    } else {
        $dept = pg_fetch_array($deptRslt);
    }
    # insert callout document to DB
    db_connect();
    # begin updating
    pglib_transaction("BEGIN") or errDie("Unable to start a database transaction.", SELF);
    /* -- Start remove old items -- */
    # get selected stock in this callout document
    $sql = "SELECT * FROM cubit.callout_docs_items WHERE calloutid = '{$calloutid}' AND div = '" . USER_DIV . "'";
    $stktRslt = db_exec($sql);
    #while($stkt = pg_fetch_array($stktRslt)){
    #	update stock(alloc + qty)
    #	$sql = "UPDATE stock SET alloc = (alloc - '$stkt[qty]')  WHERE stkid = '$stkt[stkid]'";
    #	$rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.",SELF);
    #}
    # remove old items
    $sql = "DELETE FROM cubit.callout_docs_items WHERE calloutid='{$calloutid}' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to update callout document items in Cubit.", SELF);
    /* -- End remove old items -- */
    $taxex = 0;
    if (isset($qtys)) {
        foreach ($qtys as $keys => $value) {
            if (isset($remprod) && in_array($keys, $remprod)) {
            } elseif (isset($accounts[$keys]) && $accounts[$keys] != 0) {
                $accounts[$keys] += 0;
                # Get selamt from selected stock
                $Sl = "SELECT * FROM core.accounts WHERE accid='{$accounts[$keys]}'";
                $Ri = db_exec($Sl) or errDie("Unable to get account data.");
                $ad = pg_fetch_array($Ri);
                # Calculate amount
                $amt[$keys] = $qtys[$keys] * $unitcost[$keys];
                $accounts[$keys] += 0;
                $descriptions[$keys] = remval($descriptions[$keys]);
                $wtd = $whids[$keys];
                # insert invoice items
                $sql = "\n\t\t\t\t\tINSERT INTO cubit.callout_docs_items (\n\t\t\t\t\t\tcalloutid, whid, stkid, qty, \n\t\t\t\t\t\tunitcost, amt, div, \n\t\t\t\t\t\tdescription, account\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t'{$calloutid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', \n\t\t\t\t\t\t'{$unitcost[$keys]}', '{$amt[$keys]}', '" . USER_DIV . "', \n\t\t\t\t\t\t'{$descriptions[$keys]}','{$accounts[$keys]}'\n\t\t\t\t\t)";
                $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.", SELF);
            } else {
                # get selamt from selected stock
                $sql = "SELECT * FROM stock WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'";
                $stkRslt = db_exec($sql);
                $stk = pg_fetch_array($stkRslt);
                # Calculate amount
                $amt[$keys] = $qtys[$keys] * $unitcost[$keys];
                $wtd = $whids[$keys];
                # insert callout document items
                $sql = "\n\t\t\t\t\tINSERT INTO cubit.callout_docs_items (\n\t\t\t\t\t\tcalloutid, whid, stkid, qty, \n\t\t\t\t\t\tunitcost, amt, div\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t'{$calloutid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', \n\t\t\t\t\t\t'{$unitcost[$keys]}','{$amt[$keys]}', '" . USER_DIV . "'\n\t\t\t\t\t)";
                $rslt = db_exec($sql) or errDie("Unable to insert callout document items to Cubit.", SELF);
                # update stock(alloc + qty)
                # $sql = "UPDATE stock SET alloc = (alloc + '$qtys[$keys]') WHERE stkid = '$stkids[$keys]'";
                # $rslt = db_exec($sql) or errDie("Unable to update stock to Cubit.",SELF);
            }
            # everything is set place done button
            $_POST["done"] = " | <input name='doneBtn' type='submit' value='Done'>";
        }
    } else {
        $_POST["done"] = "";
    }
    /* --- ----------- Clac --------------------- */
    ##----------------------NEW----------------------
    $sub = 0.0;
    if (isset($amt)) {
        $sub = sprint(array_sum($amt));
    }
    $subtotal = sprint($sub);
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:67,代码来源:callout-new.php

示例12: account_info

function account_info($_POST)
{
    $Out = "";
    #get & send vars
    foreach ($_POST as $key => $value) {
        ${$key} = remval($value);
        $Out .= "<input type=hidden name=\${$key} value='{$value}'>";
    }
    # validate input
    require_lib("validate");
    $v = new validate();
    # display errors, if any
    if ($v->isError()) {
        $errors = "";
        $Errors = $v->getErrors();
        foreach ($Errors as $e) {
            $errors .= "<li class=err>" . $e["msg"];
        }
        $errors .= "<input type=hidden name=errors value='{$errors}'>";
        return order($_POST, $errors);
    }
    if (isset($cc)) {
        $com = "Yes";
    } else {
        $com = "No";
    }
    $op = USER_NAME;
    db_conn("cubit");
    if (strlen($des) > 0) {
        $Sl = "INSERT INTO todos (datemade,timemade,op,des,com) VALUES ('{$datemade}','{$timemade}','{$op}','{$des}','{$com}')";
        $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF);
    }
    if (isset($done)) {
        #get & send vars
        foreach ($done as $key => $value) {
            $Sl = "UPDATE todos SET com='Yes' WHERE id='{$key}'";
            $Rs = db_exec($Sl) or errDie("Unable to update database.", SELF);
        }
    }
    return order($_POST);
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:41,代码来源:todo.php

示例13: printInv

function printInv($_POST)
{
    # get vars
    extract($_POST);
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($from_day, "num", 1, 2, "Invalid from Date day.");
    $v->isOk($from_month, "num", 1, 2, "Invalid from Date month.");
    $v->isOk($from_year, "num", 1, 4, "Invalid from Date Year.");
    $v->isOk($to_day, "num", 1, 2, "Invalid to Date day.");
    $v->isOk($to_month, "num", 1, 2, "Invalid to Date month.");
    $v->isOk($to_year, "num", 1, 4, "Invalid to Date Year.");
    # mix dates
    $fromdate = $from_year . "-" . $from_month . "-" . $from_day;
    $todate = $to_year . "-" . $to_month . "-" . $to_day;
    if (!checkdate($from_month, $from_day, $from_year)) {
        $v->isOk($fromdate, "num", 1, 1, "Invalid from date.");
    }
    if (!checkdate($to_month, $to_day, $to_year)) {
        $v->isOk($todate, "num", 1, 1, "Invalid to date.");
    }
    # display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>{$e['msg']}</li>";
        }
        return $confirm;
    }
    $accnum = remval($accnum);
    if (strlen($accnum) > 0) {
        db_conn('cubit');
        $Sl = "SELECT * FROM customers WHERE lower(accno)=lower('{$accnum}')";
        $Ri = db_exec($Sl);
        if (pg_num_rows($Ri) < 1) {
            return "<li class='err'>Invalid account number</li>" . slct();
        }
        $cd = pg_fetch_array($Ri);
        $cusnum = $cd['cusnum'];
    }
    # Set up table to display in
    $printInv = "\n\t\t<h3>Paid Invoices</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Department</th>\n\t\t\t\t<th>Invoice No.</th>\n\t\t\t\t<th>Proforma Inv No.</th>\n\t\t\t\t<th>Invoice Date</th>\n\t\t\t\t<th>Customer Name</th>\n\t\t\t\t<th>Order No</th>\n\t\t\t\t<th>Customer Order No</th>\n\t\t\t\t<th>Grand Total</th>\n\t\t\t\t<th>Documents</th>\n\t\t\t\t<th colspan='5'>Options</th>\n\t\t\t</tr>";
    // Retrieve template setting
    db_conn("cubit");
    $sql = "SELECT filename FROM template_settings WHERE template='invoices'";
    $tsRslt = db_exec($sql) or errDie("Unable to retrieve template settings from Cubit.");
    $template = pg_fetch_result($tsRslt, 0);
    if ($template == "invoice-print.php") {
        $repr = "invoice-reprint-prd.php";
    } else {
        $repr = $template;
    }
    db_conn("cubit");
    $sql = "SELECT filename FROM template_settings WHERE template='reprints'";
    $tsRslt = db_exec($sql) or errDie("Unable to retrieve template settings from Cubit.");
    $template = pg_fetch_result($tsRslt, 0);
    if ($template == "new") {
        $pdf_repr = "pdf/pdf-tax-invoice.php";
    } else {
        $pdf_repr = "pdf/invoice-pdf-reprint-prd.php";
    }
    # Query server
    $i = 0;
    $tot1 = 0;
    $tot2 = 0;
    if (isset($all)) {
        # Connect to database
        db_connect();
        $queries = array();
        for ($i = 1; $i <= 12; $i++) {
            $schema = (int) $i;
            $queries[] = "SELECT *,'{$schema}' AS query_schema FROM \"{$schema}\".invoices WHERE done = 'y' AND odate >= '{$fromdate}' AND odate <= '{$todate}' AND div = '" . USER_DIV . "'";
        }
        $query = implode(" UNION ", $queries);
        $query .= " ORDER BY invid DESC";
    } else {
        # Connect to database
        db_connect();
        $queries = array();
        for ($i = 1; $i <= 12; $i++) {
            $schema = (int) $i;
            $queries[] = "SELECT *,'{$schema}' AS query_schema FROM \"{$schema}\".invoices WHERE done = 'y' AND cusnum = '{$cusnum}' AND odate >= '{$fromdate}' AND odate <= '{$todate}' AND div = '" . USER_DIV . "'";
        }
        $query = implode(" UNION ", $queries);
        $query .= " ORDER BY invid DESC";
    }
    $invRslt = db_exec($query) or errDie("Unable to retrieve invoices from database.");
    if (pg_numrows($invRslt) < 1) {
        $printInv = "<li class='err'>No previous finished invoices found.</li>";
    } else {
        while ($inv = pg_fetch_array($invRslt)) {
            $prd = $inv["query_schema"];
            $inv['total'] = sprint($inv['total']);
            $inv['balance'] = sprint($inv['balance']);
            $tot1 = $tot1 + $inv['total'];
            $tot2 = $tot2 + $inv['balance'];
            # format date
            $inv['odate'] = explode("-", $inv['odate']);
//.........这里部分代码省略.........
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:invoice-view-prd.php

示例14: write


//.........这里部分代码省略.........
            # everything is set place done button
            $_POST["done"] = " | <input name='doneBtn' type='submit' value='Done'>| <input name='print' type='submit' value='Process'>";
        }
    } else {
        $_POST["done"] = "";
    }
    $_POST['showvat'] = $showvat;
    /* --- ----------- Clac --------------------- */
    ##----------------------NEW----------------------
    $sub = 0.0;
    if (isset($amt)) {
        $sub = sprint(array_sum($amt));
    }
    $VATP = TAX_VAT;
    if ($chrgvat == "no") {
        $subtotal = sprint($sub);
        $subtotal = sprint($subtotal);
        // 		$VAT=sprint(($subtotal-$taxex)*$VATP/100);
        $VAT = $vatamount;
        $SUBTOT = $sub;
        $TOTAL = sprint($subtotal + $VAT);
    } elseif ($chrgvat == "yes") {
        $subtotal = sprint($sub);
        $subtotal = sprint($subtotal);
        // 		$VAT=sprint(($subtotal-$taxex)*$VATP/(100+$VATP));
        $VAT = $vatamount;
        $SUBTOT = sprint($sub);
        $TOTAL = sprint($subtotal);
    } else {
        $subtotal = sprint($sub);
        $traddiscmt = sprint($subtotal);
        $subtotal = sprint($subtotal);
        $VAT = sprint(0);
        $SUBTOT = $sub;
        $TOTAL = $subtotal;
    }
    /* --- ----------- Clac --------------------- */
    ##----------------------END----------------------
    /* --- Clac ---
    	# calculate subtot
    	if( isset($amt) ){
    		$SUBTOT = array_sum($amt);
    	}else{
    		$SUBTOT = 0.00;
    	}
    
    	$SUBTOT -= $taxex;
    
    	$VATP = TAX_VAT;
    	if($chrgvat == "no"){
    		$SUBTOT = $SUBTOT;
    	}elseif($chrgvat == "yes"){
    		$SUBTOT = sprint(($SUBTOT * 100)/(100 + $VATP));
    	}else{
    		$SUBTOT = ($SUBTOT);
    	}
    
    	if($chrgvat != "none"){
    		$VAT = sprint($SUBTOT * ($VATP/100));
    	}else{
    		$VAT = 0;
    	}
    
    	$TOTAL = sprint($SUBTOT + $VAT + $taxex);
    	$SUBTOT += $taxex;
    
    	/* --- End Clac --- */
    $salespn = remval($salespn);
    if (!isset($bankid)) {
        if (isset($cusnum) and strlen($cusnum) > 0) {
            #get bankid from customer info
            $get_cbank = "SELECT bankid FROM customers WHERE cusnum = '{$cusnum}' LIMIT 1";
            $run_cbank = db_exec($get_cbank) or errDie("Unable to get bank information for customer.");
            if (pg_numrows($run_cbank) > 0) {
                $bankid = pg_fetch_result($run_cbank, 0, 0);
            } else {
                $bankid = "2";
            }
        } else {
            $bankid = "2";
        }
    }
    # insert purchase to DB
    $sql = "\n\t\tUPDATE nons_invoices \n\t\tSET salespn='{$salespn}', cusname = '{$cusname}', cusaddr = '{$cusaddr}', \n\t\t\tcusvatno = '{$cusvatno}', cordno = '{$cordno}', docref = '{$docref}', \n\t\t\tchrgvat = '{$chrgvat}', odate = '{$odate}', terms = '{$terms}', \n\t\t\tsubtot = '{$SUBTOT}', vat = '{$VAT}', total = '{$TOTAL}', \n\t\t\tremarks = '{$remarks}', bankid = '{$bankid}' \n\t\tWHERE invid = '{$invid}' AND div = '" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Unable to update invoice in Cubit.", SELF);
    # commit updating
    pglib_transaction("COMMIT") or errDie("Unable to commit a database transaction.", SELF);
    if (isset($print)) {
        $OUTPUT = "<script>printer('nons-invoice-print.php?invid={$invid}');move('nons-invoice-new.php');</script>";
        require "template.php";
    }
    if (!isset($doneBtn)) {
        return details($_POST);
    } else {
        //$rslt = db_exec($sql) or errDie("Unable to update invoices status in Cubit.$sql",SELF);
        # Final Laytout
        $write = "\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>New Non-Stock Invoices</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Non-Stock Invoices for Customer <b>{$cusname}</b> has been recorded.</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td><a href='nons-invoice-view.php'>View Non-Stock Invoices</a></td>\n\t\t\t\t</tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
        return $write;
    }
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:101,代码来源:nons-multiline-invoice-new.php

示例15: write


//.........这里部分代码省略.........
                $ad = pg_fetch_array($Ri);
                # Calculate amount
                $amt[$keys] = $qtys[$keys] * $unitcost[$keys];
                db_conn('cubit');
                $Sl = "SELECT * FROM vatcodes WHERE id='{$vatcodes[$keys]}'";
                $Ri = db_exec($Sl);
                if (pg_num_rows($Ri) < 1) {
                    return details($_POST, "<li class='err'>Please select the vatcode for all your items.</li>");
                }
                $vd = pg_fetch_array($Ri);
                if ($vd['zero'] == "Yes") {
                    $excluding = "y";
                } else {
                    $excluding = "";
                }
                if (TAX_VAT != $vd['vat_amount'] and $vd['vat_amount'] != "0.00") {
                    $showvat = FALSE;
                }
                $vr = vatcalc($amt[$keys], $inv['chrgvat'], $excluding, $inv['traddisc'], $vd['vat_amount']);
                $vrs = explode("|", $vr);
                $ivat = $vrs[0];
                $iamount = $vrs[1];
                $vatamount += $ivat;
                # Check Tax Excempt
                if ($vd['zero'] == "Yes") {
                    $taxex += $amt[$keys];
                    $exvat = "y";
                } else {
                    $exvat = "n";
                }
                //$newvat+=vatcalc($amt[$keys],$chrgvat,$exvat,$traddisc);
                $vatcodes[$keys] += 0;
                $accounts[$keys] += 0;
                $descriptions[$keys] = remval($descriptions[$keys]);
                $wtd = $whids[$keys];
                # insert invoice items
                $sql = "\n\t\t\t\t\t\tINSERT INTO recinv_items (\n\t\t\t\t\t\t\tinvid, whid, stkid, qty, unitcost, \n\t\t\t\t\t\t\tamt, disc, discp,  div, vatcode, \n\t\t\t\t\t\t\tdescription, account\n\t\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t\t'{$invid}', '{$whids[$keys]}', '{$stkids[$keys]}', '{$qtys[$keys]}', '{$unitcost[$keys]}', \n\t\t\t\t\t\t\t'{$amt[$keys]}', '{$disc[$keys]}', '{$discp[$keys]}', '" . USER_DIV . "', '{$vatcodes[$keys]}', \n\t\t\t\t\t\t\t'{$descriptions[$keys]}', '{$accounts[$keys]}'\n\t\t\t\t\t\t)";
                $rslt = db_exec($sql) or errDie("Unable to insert invoice items to Cubit.", SELF);
            } else {
                # Get selamt from selected stock
                $sql = "SELECT * FROM stock WHERE stkid = '{$stkids[$keys]}' AND div = '" . USER_DIV . "'";
                $stkRslt = db_exec($sql);
                $stk = pg_fetch_array($stkRslt);
                # Calculate the Discount discount
                if ($disc[$keys] < 1) {
                    if ($discp[$keys] > 0) {
                        $disc[$keys] = $discp[$keys] / 100 * $unitcost[$keys];
                    }
                } else {
                    $discp[$keys] = $disc[$keys] * 100 / $unitcost[$keys];
                }
                # Calculate amount
                $amt[$keys] = $qtys[$keys] * ($unitcost[$keys] - $disc[$keys]);
                $Sl = "SELECT * FROM vatcodes WHERE id='{$vatcodes[$keys]}'";
                $Ri = db_exec($Sl);
                if (pg_num_rows($Ri) < 1) {
                    return details($_POST, "<li class='err'>Please select the vatcode for all your items.</li>");
                }
                $vd = pg_fetch_array($Ri);
                if ($vd['zero'] == "Yes") {
                    $excluding = "y";
                } else {
                    $excluding = "";
                }
                if (TAX_VAT != $vd['vat_amount'] and $vd['vat_amount'] != "0.00") {
                    $showvat = FALSE;
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:67,代码来源:rec-invoice-new.php


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