Example #1
0
 }
 // cleanup the data (csv files often import with empty strings and such)
 foreach ($myrow as &$value) {
     $value = trim($value);
     $value = str_replace('"', '', $value);
 }
 //first off check that the account code actually exists
 $sql = "SELECT COUNT(accountcode) FROM chartmaster WHERE accountcode='" . $myrow[1] . "'";
 $result = DB_query($sql, $db);
 $testrow = DB_fetch_row($result);
 if ($testrow[0] == 0) {
     $InputError = 1;
     prnMsg(_('Account code' . ' ' . $myrow[1] . ' ' . 'does not exist'), 'error');
 }
 //Then check that the date is in a correct format
 if (!Is_date($myrow[0])) {
     $InputError = 1;
     prnMsg(_('The date "' . $myrow[0] . '" is not in the correct format'), 'error');
 }
 //Then check that the tag ref is either zero, or exists in the tags table
 if ($myrow[5] != 0) {
     $sql = "SELECT COUNT(tagref) FROM tags WHERE tagref='" . $myrow[5] . "'";
     $result = DB_query($sql, $db);
     $testrow = DB_fetch_row($result);
     if ($testrow[0] == 0) {
         $InputError = 1;
         prnMsg(_('Tag ref "' . $myrow[5] . '" does not exist'), 'error');
     }
 }
 //Find the period number from the date
 $Period = GetPeriod($myrow[0], $db);
Example #2
0
<?php

include 'includes/session.inc';
$Title = _('Orders Invoiced Report');
$InputError = 0;
if (isset($_POST['FromDate']) and !Is_date($_POST['FromDate'])) {
    $msg = _('The date from must be specified in the format') . ' ' . $DefaultDateFormat;
    $InputError = 1;
    unset($_POST['FromDate']);
}
if (isset($_POST['ToDate']) and !Is_date($_POST['ToDate'])) {
    $msg = _('The date to must be specified in the format') . ' ' . $DefaultDateFormat;
    $InputError = 1;
    unset($_POST['ToDate']);
}
if (isset($_POST['FromDate']) and isset($_POST['ToDate']) and Date1GreaterThanDate2($_POST['FromDate'], $_POST['ToDate'])) {
    $msg = _('The date to must be after the date from');
    $InputError = 1;
    unset($_POST['ToDate']);
    unset($_POST['FromoDate']);
}
if (!isset($_POST['FromDate']) or !isset($_POST['ToDate']) or $InputError == 1) {
    include 'includes/header.inc';
    if ($InputError == 1) {
        prnMsg($msg, 'error');
    }
    echo '<p class="page_title_text noPrint" ><img src="' . $RootPath . '/css/' . $Theme . '/images/transactions.png" title="' . $Title . '" alt="" />' . ' ' . _('Orders Invoiced Report') . '</p>';
    echo '<form onSubmit="return VerifyForm(this);" method="post" class="noPrint" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
    echo '<div>';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<table class="selection">
Example #3
0
     }
     $TaxTotal += $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount;
 }
 //$_SESSION['SuppTrans']->Taxes as $Tax
 $InputError = False;
 if ($TaxTotal + $_SESSION['SuppTrans']->OvAmount < 0) {
     $InputError = True;
     prnMsg(_('The invoice as entered cannot be processed because the total amount of the invoice is less than  0') . '. ' . _('Invoices are expected to have a positive charge'), 'error');
     echo '<p>' . _('The tax total is') . ' : ' . locale_number_format($TaxTotal, $_SESSION['SuppTrans']->CurrDecimalPlaces);
     echo '<p>' . _('The ovamount is') . ' : ' . locale_number_format($_SESSION['SuppTrans']->OvAmount, $_SESSION['SuppTrans']->CurrDecimalPlaces);
 } elseif ($TaxTotal + $_SESSION['SuppTrans']->OvAmount == 0) {
     prnMsg(_('The invoice as entered will be processed but be warned the amount of the invoice is  zero!') . '. ' . _('Invoices are normally expected to have a positive charge'), 'warn');
 } elseif (mb_strlen($_SESSION['SuppTrans']->SuppReference) < 1) {
     $InputError = True;
     prnMsg(_('The invoice as entered cannot be processed because the there is no suppliers invoice number or reference entered') . '. ' . _('The supplier invoice number must be entered'), 'error');
 } elseif (!Is_date($_SESSION['SuppTrans']->TranDate)) {
     $InputError = True;
     prnMsg(_('The invoice as entered cannot be processed because the invoice date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error');
 } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0) {
     $InputError = True;
     prnMsg(_('The invoice as entered cannot be processed because the invoice date is after today') . '. ' . _('Purchase invoices are expected to have a date prior to or today'), 'error');
 } elseif ($_SESSION['SuppTrans']->ExRate <= 0) {
     $InputError = True;
     prnMsg(_('The invoice as entered cannot be processed because the exchange rate for the invoice has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'), 'error');
 } elseif ($_SESSION['SuppTrans']->OvAmount < round($_SESSION['SuppTrans']->Total_Shipts_Value() + $_SESSION['SuppTrans']->Total_GL_Value() + $_SESSION['SuppTrans']->Total_Contracts_Value() + $_SESSION['SuppTrans']->Total_Assets_Value() + $_SESSION['SuppTrans']->Total_GRN_Value(), $_SESSION['SuppTrans']->CurrDecimalPlaces)) {
     prnMsg(_('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any), the charges for goods received, contract charges and fixed asset charges. There must be a mistake somewhere, the invoice as entered will not be processed'), 'error');
     $InputError = True;
 } else {
     $sql = "SELECT count(*)\n\t\t\t\tFROM supptrans\n\t\t\t\tWHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "'\n\t\t\t\tAND supptrans.suppreference='" . $_POST['SuppReference'] . "'";
     $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sql to check for the previous entry of the same invoice failed');
     $DbgMsg = _('The following SQL to test for a previous invoice with the same reference from the same supplier was used');