echo '</select>
					</td>
				</tr>
				<tr>
					<td>' . _('Sales Person') . '</td>
					<td><select name="SalesPerson">
						<option selected="selected" value="">' . _('All') . '</option>';
    while ($SalesPersonRow = DB_fetch_array($SalesFolkResult)) {
        echo '<option value="' . $SalesPersonRow['salesmancode'] . '">' . $SalesPersonRow['salesmanname'] . '</option>';
    }
    echo '</select>
					</td>
				</tr>
				<tr>
					<td>' . _('Date From') . ':</td>
					<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - $_SESSION['NumberOfMonthMustBeShown'], Date('d'), Date('Y'))) . '" /></td>
				</tr>
				<tr>
					<td>' . _('Date To') . ':</td>
					<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td>
				</tr>
				<tr>
					<td>' . _('Create CSV') . ':</td>
					<td><input type="checkbox" name="CreateCSV" value=""></td>
				</tr>

			</table>
			<br />
			<div class="centre">
				<input tabindex="4" type="submit" name="RunReport" value="' . _('Show Customer Balance Movements') . '" />
			</div>
function GetCurrentPeriod(&$db)
{
    $TransDate = time();
    //The current date to find the period for
    /* Find the unix timestamp of the last period end date in periods table */
    $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    if (is_null($myrow[0])) {
        $InsertFirstPeriodResult = api_DB_query("INSERT INTO periods VALUES (0,'" . Date('Y-m-d', mktime(0, 0, 0, Date('m') + 1, 0, Date('Y'))) . "')", $db);
        $InsertFirstPeriodResult = api_DB_query("INSERT INTO periods VALUES (1,'" . Date('Y-m-d', mktime(0, 0, 0, Date('m') + 2, 0, Date('Y'))) . "')", $db);
        $LastPeriod = 1;
        $LastPeriodEnd = mktime(0, 0, 0, Date('m') + 2, 0, Date('Y'));
    } else {
        $Date_Array = explode('-', $myrow[0]);
        $LastPeriodEnd = mktime(0, 0, 0, $Date_Array[1] + 1, 0, (int) $Date_Array[0]);
        $LastPeriod = $myrow[1];
    }
    /* Find the unix timestamp of the first period end date in periods table */
    $sql = "SELECT MIN(lastdate_in_period), MIN(periodno) from periods";
    $result = api_DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    $Date_Array = explode('-', $myrow[0]);
    $FirstPeriodEnd = mktime(0, 0, 0, $Date_Array[1], 0, (int) $Date_Array[0]);
    $FirstPeriod = $myrow[1];
    /* If the period number doesn't exist */
    if (!PeriodExists($TransDate, $db)) {
        /* if the transaction is after the last period */
        if ($TransDate > $LastPeriodEnd) {
            $PeriodEnd = mktime(0, 0, 0, Date('m', $TransDate) + 1, 0, Date('Y', $TransDate));
            while ($PeriodEnd >= $LastPeriodEnd) {
                if (Date('m', $LastPeriodEnd) <= 13) {
                    $LastPeriodEnd = mktime(0, 0, 0, Date('m', $LastPeriodEnd) + 2, 0, Date('Y', $LastPeriodEnd));
                } else {
                    $LastPeriodEnd = mktime(0, 0, 0, 2, 0, Date('Y', $LastPeriodEnd) + 1);
                }
                $LastPeriod++;
                CreatePeriod($LastPeriod, $LastPeriodEnd, $db);
            }
        } else {
            /* The transaction is before the first period */
            $PeriodEnd = mktime(0, 0, 0, Date('m', $TransDate), 0, Date('Y', $TransDate));
            $Period = $FirstPeriod - 1;
            while ($FirstPeriodEnd > $PeriodEnd) {
                CreatePeriod($Period, $FirstPeriodEnd, $db);
                $Period--;
                if (Date('m', $FirstPeriodEnd) > 0) {
                    $FirstPeriodEnd = mktime(0, 0, 0, Date('m', $FirstPeriodEnd), 0, Date('Y', $FirstPeriodEnd));
                } else {
                    $FirstPeriodEnd = mktime(0, 0, 0, 13, 0, Date('Y', $FirstPeriodEnd));
                }
            }
        }
    } else {
        if (!PeriodExists(mktime(0, 0, 0, Date('m', $TransDate) + 1, Date('d', $TransDate), Date('Y', $TransDate)), $db)) {
            /* Make sure the following months period exists */
            $sql = "SELECT MAX(lastdate_in_period), MAX(periodno) from periods";
            $result = DB_query($sql, $db);
            $myrow = DB_fetch_row($result);
            $Date_Array = explode('-', $myrow[0]);
            $LastPeriodEnd = mktime(0, 0, 0, $Date_Array[1] + 2, 0, (int) $Date_Array[0]);
            $LastPeriod = $myrow[1];
            CreatePeriod($LastPeriod + 1, $LastPeriodEnd, $db);
        }
    }
    /* Now return the period number of the transaction */
    $MonthAfterTransDate = Mktime(0, 0, 0, Date('m', $TransDate) + 1, Date('d', $TransDate), Date('Y', $TransDate));
    $GetPrdSQL = "SELECT periodno\n\t\t\t\t\t\tFROM periods\n\t\t\t\t\t\tWHERE lastdate_in_period < '" . Date('Y-m-d', $MonthAfterTransDate) . "'\n\t\t\t\t\t\tAND lastdate_in_period >= '" . Date('Y-m-d', $TransDate) . "'";
    $ErrMsg = _('An error occurred in retrieving the period number');
    $GetPrdResult = DB_query($GetPrdSQL, $db, $ErrMsg);
    $myrow = DB_fetch_row($GetPrdResult);
    return $myrow[0];
}
示例#3
0
				<option selected="selected" value="All">' . _('All sales folk') . '</option>';
    $sql = "SELECT salesmancode, salesmanname FROM salesman";
    $SalesFolkResult = DB_query($sql, $db);
    while ($myrow = DB_fetch_array($SalesFolkResult)) {
        echo '<option value="' . $myrow['salesmancode'] . '">' . $myrow['salesmanname'] . '</option>';
    }
    echo '</select></td></tr>';
    echo '<tr><td>' . _('Level Of Activity') . ':</td>
			<td><select name="Activity">
				<option selected="selected" value="All">' . _('All customers') . '</option>
				<option value="GreaterThan">' . _('Sales Greater Than') . '</option>
				<option value="LessThan">' . _('Sales Less Than') . '</option>
				</select></td>
			<td>';
    echo '<input type="text" class="number" name="ActivityAmount" size="8" maxlength="8" value="0" /></td>
		</tr>';
    $DefaultActivitySince = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 6, 0, Date('y')));
    echo '<tr>
			<td>' . _('Activity Since') . ':</td>
			<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '"  name="ActivitySince" size="10" maxlength="10" value="' . $DefaultActivitySince . '" /></td>
		</tr>';
    echo '</table>
			<br />
			<div class="centre">
				<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" />
			</div>';
    echo '</div>
          </form>';
    include 'includes/footer.inc';
}
/*end of else not PrintPDF */
示例#4
0
    $ViewTopic = 'GeneralLedger';
    $BookMark = 'TrialBalance';
    include 'includes/header.inc';
    echo '<p class="page_title_text">
			<img src="' . $RootPath . '/css/' . $Theme . '/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $Title . '
		</p>';
    echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
    echo '<div>';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    if (Date('m') > $_SESSION['YearEnd']) {
        /*Dates in SQL format */
        $DefaultFromDate = Date('Y-m-d', Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y')));
        $FromDate = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y')));
    } else {
        $DefaultFromDate = Date('Y-m-d', Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y') - 1));
        $FromDate = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y') - 1));
    }
    /*GetPeriod function creates periods if need be the return value is not used */
    $NotUsedPeriodNo = GetPeriod($FromDate, $db);
    /*Show a form to allow input of criteria for TB to show */
    echo '<table class="selection">
			<tr>
				<td>' . _('Select Period From:') . '</td>
				<td><select name="FromPeriod">';
    $NextYear = date('Y-m-d', strtotime('+1 Year'));
    $sql = "SELECT periodno,\n\t\t\t\t\tlastdate_in_period\n\t\t\t\tFROM periods\n\t\t\t\tWHERE lastdate_in_period < '" . $NextYear . "'\n\t\t\t\tORDER BY periodno DESC";
    $Periods = DB_query($sql, $db);
    while ($myrow = DB_fetch_array($Periods, $db)) {
        if (isset($_POST['FromPeriod']) and $_POST['FromPeriod'] != '') {
            if ($_POST['FromPeriod'] == $myrow['periodno']) {
                echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
示例#5
0
    $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 "<FORM METHOD='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>";
    echo '<CENTER><TABLE><TR><TD>' . _('Enter the date from which orders are to be listed') . ":</TD><TD><INPUT TYPE=text NAME='FromDate' MAXLENGTH=10 SIZE=10 VALUE='" . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 1, Date('y'))) . "'></TD></TR>";
    echo '<TR><TD>' . _('Enter the date to which orders are to be listed') . ":</TD>\n     \t\t<TD><INPUT TYPE=text NAME='ToDate' MAXLENGTH=10 SIZE=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></TD></TR>";
    echo '<TR><TD>' . _('Inventory Category') . '</TD><TD>';
    $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'";
    $result = DB_query($sql, $db);
    echo "<SELECT NAME='CategoryID'>";
    echo "<OPTION SELECTED VALUE='All'>" . _('Over All Categories');
    while ($myrow = DB_fetch_array($result)) {
        echo '<OPTION VALUE=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'];
    }
    echo '</SELECT></TD></TR>';
    echo '<TR><TD>' . _('Inventory Location') . ":</TD><TD><SELECT NAME='Location'>";
    echo "<OPTION SELECTED VALUE='All'>" . _('All Locations');
    $result = DB_query('SELECT loccode, locationname FROM locations', $db);
    while ($myrow = DB_fetch_array($result)) {
        echo "<OPTION VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname'];
示例#6
0
    echo '<tr><td>' . _('Tax Authority To Report On:') . ':</td>
			<td><select name="TaxAuthority">';
    $result = DB_query("SELECT taxid, description FROM taxauthorities", $db);
    while ($myrow = DB_fetch_array($result)) {
        echo '<option value="' . $myrow['taxid'] . '">' . $myrow['description'] . '</option>';
    }
    echo '</select></td></tr>';
    echo '<tr>
			<td>' . _('Return Covering') . ':</td>
			<td><select name="NoOfPeriods">
			<option value="1">' . _('One Month') . '</option>' . '<option selected="selected" value="2">' . _('Two Months') . '</option>' . '<option value="3">' . _('Quarter') . '</option>' . '<option value="6">' . _('Six Months') . '</option>' . '</select></td>
		</tr>';
    echo '<tr>
			<td>' . _('Return To') . ':</td>
			<td><select name="ToPeriod">';
    $DefaultPeriod = GetPeriod(Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), 0, Date('Y'))), $db);
    $sql = "SELECT periodno,\n\t\t\tlastdate_in_period\n\t\tFROM periods";
    $ErrMsg = _('Could not retrieve the period data because');
    $Periods = DB_query($sql, $db, $ErrMsg);
    while ($myrow = DB_fetch_array($Periods, $db)) {
        if ($myrow['periodno'] == $DefaultPeriod) {
            echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>';
        } else {
            echo '<option value="' . $myrow['periodno'] . '">' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>';
        }
    }
    echo '</select></td>
		</tr>';
    echo '<tr>
			<td>' . _('Detail Or Summary Only') . ':</td>
			<td><select name="DetailOrSummary">
    $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 "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>";
    echo '<table><tr><td>' . _('Enter the date from which orders are to be listed') . ":</td><td><input type=text class='date' alt='" . $_SESSION['DefaultDateFormat'] . "' name='FromDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 1, Date('y'))) . "'></td></tr>";
    echo '<tr><td>' . _('Enter the date to which orders are to be listed') . ":</td>\n     \t\t<td><input type=text class='date' alt='" . $_SESSION['DefaultDateFormat'] . "' name='ToDate' maxlength=10 size=10 VALUE='" . Date($_SESSION['DefaultDateFormat']) . "'></td></tr>";
    echo '<tr><td>' . _('Inventory Category') . '</td><td>';
    $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'";
    $result = DB_query($sql, $db);
    echo "<select name='CategoryID'>";
    echo "<option selected VALUE='All'>" . _('Over All Categories');
    while ($myrow = DB_fetch_array($result)) {
        echo '<option VALUE=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'];
    }
    echo '</select></td></tr>';
    echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>";
    echo "<option selected VALUE='All'>" . _('All Locations');
    $result = DB_query('SELECT loccode, locationname FROM locations', $db);
    while ($myrow = DB_fetch_array($result)) {
        echo "<option VALUE='" . $myrow['loccode'] . "'>" . $myrow['locationname'];
示例#8
0
$sql = "SELECT bankaccounts.accountcode, \n\t\t\t\tbankaccounts.bankaccountname \n\t\tFROM bankaccounts, bankaccountusers\n\t\tWHERE bankaccounts.accountcode=bankaccountusers.accountcode\n\t\t\tAND bankaccountusers.userid = '" . $_SESSION['UserID'] . "'\n\t\tORDER BY bankaccounts.bankaccountname";
$resultBankActs = DB_query($sql, $db);
while ($myrow = DB_fetch_array($resultBankActs)) {
    if (isset($_POST['BankAccount']) and $myrow['accountcode'] == $_POST['BankAccount']) {
        echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>';
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>';
    }
}
echo '</select></td>
	</tr>';
if (!isset($_POST['BeforeDate']) or !Is_Date($_POST['BeforeDate'])) {
    $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']);
}
if (!isset($_POST['AfterDate']) or !Is_Date($_POST['AfterDate'])) {
    $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 3, Date('d'), Date('y')));
}
// Change to allow input of FROM DATE and then TO DATE, instead of previous back-to-front method, add datepicker
echo '<tr>
		<td>' . _('Show') . ' ' . $TypeName . ' ' . _('from') . ':</td>
		<td><input tabindex="3" type="text" name="AfterDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="12" maxlength="10" required="required" onchange="isDate(this, this.value, ' . "'" . $_SESSION['DefaultDateFormat'] . "'" . ')" value="' . $_POST['AfterDate'] . '" /></td>
	</tr>';
echo '<tr>
        <td>' . _('to') . ':</td>
		<td><input tabindex="2" type="text" name="BeforeDate" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="12" maxlength="10" required="required" onchange="isDate(this, this.value, ' . "'" . $_SESSION['DefaultDateFormat'] . "'" . ')" value="' . $_POST['BeforeDate'] . '" /></td>
	</tr>';
echo '<tr>
		<td colspan="3">' . _('Choose outstanding') . ' ' . $TypeName . ' ' . _('only or all') . ' ' . $TypeName . ' ' . _('in the date range') . ':</td>
		<td><select tabindex="4" name="Ostg_or_All">';
if ($_POST['Ostg_or_All'] == 'All') {
    echo '<option selected="selected" value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>';
示例#9
0
        $SelectADifferentPeriod = _('Select A Different Period');
    }
}
if (!isset($_POST['FromPeriod']) or !isset($_POST['ToPeriod']) or $SelectADifferentPeriod == _('Select A Different Period')) {
    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 '<p class="page_title_text noPrint" ><img src="' . $RootPath . '/css/' . $Theme . '/images/sales.png" title="' . _('Select criteria') . '" alt="' . _('Select criteria') . '" />' . ' ' . $Title . '</p>';
    echo '<table class="selection" summary="' . _('Criteria for the sales graph') . '">
			<tr><td>' . _('Select Period From:') . '</td>
			<td><select minlength="0" name="FromPeriod">';
    if (Date('m') > $_SESSION['YearEnd']) {
        /*Dates in SQL format */
        $DefaultFromDate = Date('Y-m-d', Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y')));
    } else {
        $DefaultFromDate = Date('Y-m-d', Mktime(0, 0, 0, $_SESSION['YearEnd'] + 2, 0, Date('Y') - 1));
    }
    $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno";
    $Periods = DB_query($sql, $db);
    while ($myrow = DB_fetch_array($Periods, $db)) {
        if (isset($_POST['FromPeriod']) and $_POST['FromPeriod'] != '') {
            if ($_POST['FromPeriod'] == $myrow['periodno']) {
                echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
            } else {
                echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
            }
        } else {
            if ($myrow['lastdate_in_period'] == $DefaultFromDate) {
                echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
            } else {
                echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
示例#10
0
    echo "<br><div class='centre'><a href='" . $rootpath . "/SelectCustomer.php?" . SID . "'>" . _('Select a Customer to Inquire On') . '</a><br></div>';
    include 'includes/footer.inc';
    exit;
} else {
    if (isset($_GET['CustomerID'])) {
        $_SESSION['CustomerID'] = $_GET['CustomerID'];
    }
    $CustomerID = $_SESSION['CustomerID'];
}
if (!isset($_POST['TransAfterDate'])) {
    $sql = 'SELECT confvalue 
			FROM `config` 
			WHERE confname ="numberOfMonthMustBeShown"';
    $result = DB_query($sql, $db, $ErrMsg);
    $row = DB_fetch_array($result);
    $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - $row['confvalue'], Date('d'), Date('Y')));
}
$SQL = 'SELECT debtorsmaster.name,
		currencies.currency,
		paymentterms.terms,
		debtorsmaster.creditlimit,
		holdreasons.dissallowinvoices,
		holdreasons.reasondescription,
		SUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount
- debtortrans.alloc) AS balance,
		SUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN
			CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue
			THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
		ELSE
			CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, ' . INTERVAL('1', 'MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ')) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END
		END) AS due,
示例#11
0
    if (isset($_POST['StockLocation']) and $_POST['StockLocation'] != 'All') {
        if ($myrow['loccode'] == $_POST['StockLocation']) {
            echo '<option selected="True" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        } else {
            echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        }
    } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) {
        echo '<option selected="True" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        $_POST['StockLocation'] = $myrow['loccode'];
    } else {
        echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
    }
}
echo '</select></td>';
if (!isset($_POST['OnHandDate'])) {
    $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date("m"), 0, Date("y")));
}
echo '<td>' . _('On-Hand On Date') . ':</td>
	<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size="12" maxlength="12" value="' . $_POST['OnHandDate'] . '" /></td></tr>';
echo '<tr><td colspan="6"><div class="centre"><button type="submit" name="ShowStatus">' . _('Show Stock Status') . '</button></div></td></tr></table>';
echo '</form>';
$TotalQuantity = 0;
if (isset($_POST['ShowStatus']) and Is_Date($_POST['OnHandDate'])) {
    if ($_POST['StockCategory'] == 'All') {
        $sql = "SELECT stockid,\n\t\t\t\tdescription,\n\t\t\t\tdecimalplaces\n\t\t\tFROM stockmaster\n\t\t\tWHERE (mbflag='M' OR mbflag='B')";
    } else {
        $sql = "SELECT stockid,\n\t\t\t\tdescription,\n\t\t\t\tdecimalplaces\n\t\t\tFROM stockmaster\n\t\t\tWHERE categoryid = '" . $_POST['StockCategory'] . "'\n\t\t\tAND (mbflag='M' OR mbflag='B')";
    }
    $ErrMsg = _('The stock items in the category selected cannot be retrieved because');
    $DbgMsg = _('The SQL that failed was');
    $StockResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
示例#12
0
//echo "<a href='" . $rootpath . '/SelectSupplier.php?' . SID . "'>" . _('Back to Suppliers') . '</a><br>';
// always figure out the SQL required from the inputs available
if (!isset($_GET['SupplierID']) and !isset($_SESSION['SupplierID'])) {
    echo '<br>' . _('To display the enquiry a Supplier must first be selected from the Supplier selection screen') . "<br><div class='centre'>><a href='" . $rootpath . "/SelectSupplier.php'>" . _('Select a Supplier to Inquire On') . '</a></div>';
    exit;
} else {
    if (isset($_GET['SupplierID'])) {
        $_SESSION['SupplierID'] = $_GET['SupplierID'];
    }
    $SupplierID = $_SESSION['SupplierID'];
}
if (isset($_GET['FromDate'])) {
    $_POST['TransAfterDate'] = $_GET['FromDate'];
}
if (!isset($_POST['TransAfterDate']) or !Is_Date($_POST['TransAfterDate'])) {
    $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date("m") - 12, Date("d"), Date("Y")));
}
$SQL = 'SELECT suppliers.suppname, 
		currencies.currency, 
		paymentterms.terms,
		SUM(supptrans.ovamount + supptrans.ovgst - supptrans.alloc) AS balance,
		SUM(CASE WHEN paymentterms.daysbeforedue > 0 THEN
			CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= paymentterms.daysbeforedue
			THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
		ELSE 
			CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(supptrans.trandate, ' . INTERVAL('1', 'MONTH') . '), ' . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(supptrans.trandate))', 'DAY') . ')) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
		END) AS due,
		SUM(CASE WHEN paymentterms.daysbeforedue > 0  THEN 
			CASE WHEN (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) > paymentterms.daysbeforedue 
					AND (TO_DAYS(Now()) - TO_DAYS(supptrans.trandate)) >= (paymentterms.daysbeforedue + ' . $_SESSION['PastDueDays1'] . ')
			THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END
$InputError = 0;
if (isset($_POST['FromDate']) and !Is_Date($_POST['FromDate'])) {
    $msg = _('The date from must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat'];
    $InputError = 1;
}
if (isset($_POST['ToDate']) and !Is_Date($_POST['ToDate'])) {
    $msg = _('The date to must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat'];
    $InputError = 1;
}
if (!isset($_POST['FromDate']) or !isset($_POST['ToDate']) or $InputError == 1) {
    $title = _('Delivery Differences Report');
    include 'includes/header.inc';
    echo '<div class="centre"><p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . _('Delivery Differences Report') . '</p>';
    echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<table class="selection"><tr><td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 1, 0, Date('y'))) . '" /></td></tr>';
    echo '<tr><td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td><td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '"  name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td></tr>';
    echo '<tr><td>' . _('Inventory Category') . '</td><td>';
    $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'";
    $result = DB_query($sql, $db);
    echo '<select name="CategoryID">';
    echo '<option selected="True" value="All">' . _('Over All Categories') . '</option>';
    while ($myrow = DB_fetch_array($result)) {
        echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
    }
    echo '</select></td></tr>';
    echo '<tr><td>' . _('Inventory Location') . ":</td><td><select name='Location'>";
    echo '<option selected="True" value="All">' . _('All Locations') . '</option>';
    $result = DB_query("SELECT loccode, locationname FROM locations", $db);
    while ($myrow = DB_fetch_array($result)) {
        echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
	<td>' . $_SESSION['Items' . $identifier]->Comments . '</td></tr>';
if (!isset($_POST['StartDate'])) {
    $_POST['StartDate'] = date($_SESSION['DefaultDateFormat']);
}
if ($NewRecurringOrder == 'Yes') {
    echo '<tr>
	<td>' . _('Start Date') . ':</td>
	<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="StartDate" size="11" maxlength="10" value="' . $_POST['StartDate'] . '" /></td></tr>';
} else {
    echo '<tr>
	<td>' . _('Last Recurrence') . ':</td>
	<td>' . $_POST['StartDate'];
    echo '<input type="hidden" name="StartDate" value="' . $_POST['StartDate'] . '" /></td></tr>';
}
if (!isset($_POST['StopDate'])) {
    $_POST['StopDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') + 1, Date('y') + 1));
}
echo '<tr>
	<td>' . _('Finish Date') . ':</td>
	<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="StopDate" size="11" maxlength="10" value="' . $_POST['StopDate'] . '" /></td></tr>';
echo '<tr>
	<td>' . _('Frequency of Recurrence') . ':</td>
	<td><select name="Frequency">';
if (isset($_POST['Frequency']) and $_POST['Frequency'] == 52) {
    echo '<option selected="selected" value="52">' . _('Weekly') . '</option>';
} else {
    echo '<option value="52">' . _('Weekly') . '</option>';
}
if (isset($_POST['Frequency']) and $_POST['Frequency'] == 26) {
    echo '<option selected="selected" value="26">' . _('Fortnightly') . '</option>';
} else {
示例#15
0
文件: BOMs.php 项目: rrsc/KwaMoja
				</tr>
				<tr>
					<td>' . _('Quantity') . ': </td>
					<td><input tabindex="4" type="text" class="number" name="Quantity" size="10" required="required" minlength="1" maxlength="8" value="';
    if (isset($_POST['Quantity'])) {
        echo $_POST['Quantity'];
    } else {
        echo 1;
    }
    echo '" /></td>
			</tr>';
    if (!isset($_POST['EffectiveTo']) or $_POST['EffectiveTo'] == '') {
        $_POST['EffectiveTo'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d'), Date('y') + 20));
    }
    if (!isset($_POST['EffectiveAfter']) or $_POST['EffectiveAfter'] == '') {
        $_POST['EffectiveAfter'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 1, Date('y')));
    }
    echo '<tr>
				<td>' . _('Effective After') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td>
				<td><input tabindex="5" type="text" name="EffectiveAfter" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="11" required="required" minlength="1" maxlength="10" value="' . $_POST['EffectiveAfter'] . '" /></td>
			</tr>
			<tr>
				<td>' . _('Effective To') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td>
				<td><input tabindex="6" type="text" name="EffectiveTo" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="11" required="required" minlength="1" maxlength="10" value="' . $_POST['EffectiveTo'] . '" /></td>
			</tr>';
    if ($ParentMBflag == 'M' or $ParentMBflag == 'G') {
        echo '<tr>
					<td>' . _('Auto Issue this Component to Work Orders') . ':</td>
					<td>
					<select required="required" minlength="1" tabindex="7" name="AutoIssue">';
        if (!isset($_POST['AutoIssue'])) {
示例#16
0
 }
 while ($StmtHeader = DB_fetch_array($StatementResults)) {
     /*loop through all the customers returned */
     /*now get all the outstanding transaction ie Settled=0 */
     $ErrMsg = _('There was a problem retrieving the outstanding transactions for') . ' ' . $StmtHeader['name'] . ' ' . _('from the database') . '.';
     $sql = "SELECT systypes.typename,\n\t\t\t\t\tdebtortrans.transno,\n\t\t\t\t\tdebtortrans.trandate,\n\t\t\t\t\tdebtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst as total,\n\t\t\t\t\tdebtortrans.alloc,\n\t\t\t\t\tdebtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc as ostdg\n\t\t\t\tFROM debtortrans INNER JOIN systypes\n\t\t\t\t\tON debtortrans.type=systypes.typeid\n\t\t\t\tWHERE debtortrans.debtorno='" . $StmtHeader['debtorno'] . "'\n\t\t\t\tAND debtortrans.settled=0";
     if ($_SESSION['SalesmanLogin'] != '') {
         $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
     }
     $sql .= " ORDER BY debtortrans.id";
     $OstdgTrans = DB_query($sql, $db, $ErrMsg);
     $NumberOfRecordsReturned = DB_num_rows($OstdgTrans);
     /*now get all the settled transactions which were allocated this month */
     $ErrMsg = _('There was a problem retrieving the transactions that were settled over the course of the last month for') . ' ' . $StmtHeader['name'] . ' ' . _('from the database');
     if ($_SESSION['Show_Settled_LastMonth'] == 1) {
         $sql = "SELECT DISTINCT debtortrans.id,\n\t\t\t\t\t\t\t\tsystypes.typename,\n\t\t\t\t\t\t\t\tdebtortrans.transno,\n\t\t\t\t\t\t\t\tdebtortrans.trandate,\n\t\t\t\t\t\t\t\tdebtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst AS total,\n\t\t\t\t\t\t\t\tdebtortrans.alloc,\n\t\t\t\t\t\t\t\tdebtortrans.ovamount+debtortrans.ovdiscount+debtortrans.ovfreight+debtortrans.ovgst-debtortrans.alloc AS ostdg\n\t\t\t\t\t\tFROM debtortrans INNER JOIN systypes\n\t\t\t\t\t\t\tON debtortrans.type=systypes.typeid\n\t\t\t\t\t\tINNER JOIN custallocns\n\t\t\t\t\t\t\tON (debtortrans.id=custallocns.transid_allocfrom\n\t\t\t\t\t\t\t\tOR debtortrans.id=custallocns.transid_allocto)\n\t\t\t\t\t\tWHERE custallocns.datealloc >='" . Date('Y-m-d', Mktime(0, 0, 0, Date('m') - 1, Date('d'), Date('y'))) . "'\n\t\t\t\t\t\tAND debtortrans.debtorno='" . $StmtHeader['debtorno'] . "'\n\t\t\t\t\t\tAND debtortrans.settled=1";
         if ($_SESSION['SalesmanLogin'] != '') {
             $sql .= " AND debtortrans.salesperson='" . $_SESSION['SalesmanLogin'] . "'";
         }
         $sql .= " ORDER BY debtortrans.id";
         $SetldTrans = DB_query($sql, $db, $ErrMsg);
         $NumberOfRecordsReturned += DB_num_rows($SetldTrans);
     }
     if ($NumberOfRecordsReturned >= 1) {
         /* Then there's a statement to print. So print out the statement header from the company record */
         $PageNumber = 1;
         if ($FirstStatement == True) {
             $FirstStatement = False;
         } else {
             $pdf->newPage();
         }
示例#17
0
$ViewTopic = 'GeneralLedger';
$BookMark = 'GLAccountCSV';
include 'includes/header.inc';
include 'includes/GLPostings.inc';
if (isset($_POST['Period'])) {
    $SelectedPeriod = $_POST['Period'];
} elseif (isset($_GET['Period'])) {
    $SelectedPeriod = $_GET['Period'];
}
echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/transactions.png" title="' . _('General Ledger Account Inquiry') . '" alt="" />' . ' ' . _('General Ledger Account Report') . '</p>';
echo '<div class="page_help_text">' . _('Use the keyboard Shift key to select multiple accounts and periods') . '</div><br />';
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
/*Dates in SQL format for the last day of last month*/
$DefaultPeriodDate = Date('Y-m-d', Mktime(0, 0, 0, Date('m'), 0, Date('Y')));
/*Show a form to allow input of criteria for the report */
echo '<table>
	        <tr>
	         <td>' . _('Selected Accounts') . ':</td>
	         <td><select name="Account[]" size="12" multiple="multiple">';
$sql = "SELECT accountcode, accountname FROM chartmaster ORDER BY accountcode";
$AccountsResult = DB_query($sql);
$i = 0;
while ($myrow = DB_fetch_array($AccountsResult, $db)) {
    if (isset($_POST['Account'][$i]) and $myrow['accountcode'] == $_POST['Account'][$i]) {
        echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' ' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . '</option>';
        $i++;
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' ' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . '</option>';
    }
    $SelectedStockItem = $_GET['SelectedStockItem'];
} elseif (isset($_POST['SelectedStockItem'])) {
    $SelectedStockItem = $_POST['SelectedStockItem'];
}
if (isset($_GET['LotNumber'])) {
    $LotNumber = $_GET['LotNumber'];
} elseif (isset($_POST['LotNumber'])) {
    $LotNumber = $_POST['LotNumber'];
}
if (isset($_GET['SampleID'])) {
    $SampleID = $_GET['SampleID'];
} elseif (isset($_POST['SampleID'])) {
    $SampleID = $_POST['SampleID'];
}
if (!isset($_POST['FromDate'])) {
    $_POST['FromDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 15, Date('Y')));
}
if (!isset($_POST['ToDate'])) {
    $_POST['ToDate'] = Date($_SESSION['DefaultDateFormat']);
}
if (isset($Errors)) {
    unset($Errors);
}
$Errors = array();
echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
if (isset($_POST['submit'])) {
    //initialise no input errors assumed initially before we test
    $InputError = 0;
    /* actions to take once the user has clicked the submit button
    	ie the page has called itself with some user input */
    $i = 1;
示例#19
0
        echo $TableHeader;
    }
}
echo '<tr>
		<td colspan="5" class="number"><h4>' . _('Total Value Credited Against Goods') . ':</h4></td>
		<td class="number"><h4>' . locale_number_format($TotalValueCharged, $_SESSION['SuppTrans']->CurrDecimalPlaces) . '</h4></td>
          </tr>';
echo '</table>
	<br />
	<div class="centre">
		<a href="' . $rootpath . '/SupplierCredit.php?">' . _('Back to Credit Note Entry') . '</a>
	</div>';
/* Now get all the GRNs for this supplier from the database
after the date entered */
if (!isset($_POST['Show_Since'])) {
    $_POST['Show_Since'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 2, Date('d'), Date('Y')));
}
$SQL = "SELECT grnno,\n\t\t\tpurchorderdetails.orderno,\n\t\t\tpurchorderdetails.unitprice,\n\t\t\tpurchorderdetails.actprice,\n\t\t\tgrns.itemcode, \n\t\t\tgrns.deliverydate,\n\t\t\tgrns.itemdescription,\n\t\t\tgrns.qtyrecd,\n\t\t\tgrns.quantityinv,\n\t\t\tpurchorderdetails.stdcostunit,\n\t\t\tpurchorderdetails.assetid,\n\t\t\tstockmaster.decimalplaces\n\t\tFROM grns INNER JOIN purchorderdetails\n\t\tON grns.podetailitem=purchorderdetails.podetailitem \n\t\tLEFT JOIN stockmaster\n\t\tON purchorderdetails.itemcode=stockmaster.stockid\n\t\tWHERE grns.supplierid ='" . $_SESSION['SuppTrans']->SupplierID . "' \n\t\tAND grns.deliverydate >= '" . FormatDateForSQL($_POST['Show_Since']) . "'\n\t\tORDER BY grns.grnno";
$GRNResults = DB_query($SQL, $db);
if (DB_num_rows($GRNResults) == 0) {
    prnMsg(_('There are no goods received records for') . ' ' . $_SESSION['SuppTrans']->SupplierName . ' ' . _('since') . ' ' . $_POST['Show_Since'] . '<br /> ' . _('To enter a credit against goods received') . ', ' . _('the goods must first be received using the link below to select purchase orders to receive'), 'info');
    echo '<br />
	<a href="' . $rootpath . '/PO_SelectOSPurchOrder.php?SupplierID=' . $_SESSION['SuppTrans']->SupplierID . '">' . _('Select Purchase Orders to Receive') . '</a>';
}
/*Set up a table to show the GRNs outstanding for selection */
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<br />
	<table class="selection">
	<tr>
示例#20
0
                    $SQL = "SELECT salesorders.orderno, \n\t\t\t\t\t\tdebtorsmaster.name, \n\t\t\t\t\t\tcustbranch.brname, \n\t\t\t\t\t\tsalesorders.customerref, \n\t\t\t\t\t\tsalesorders.orddate, \n\t\t\t\t\t\tsalesorders.deliverto, \n\t\t\t\t\t\tsalesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) AS ordervalue \n\t\t\t\t\tFROM salesorders, \n\t\t\t\t\t\tsalesorderdetails, \n\t\t\t\t\t\tdebtorsmaster, \n\t\t\t\t\t\tcustbranch \n\t\t\t\t\tWHERE salesorders.orderno = salesorderdetails.orderno \n\t\t\t\t\tAND salesorders.debtorno = debtorsmaster.debtorno \n\t\t\t\t\tAND salesorders.branchcode = custbranch.branchcode \n\t\t\t\t\tAND debtorsmaster.debtorno = custbranch.debtorno \n\t\t\t\t\tAND salesorders.orddate >= '{$DateAfterCriteria}' \n\t\t\t\t\tAND salesorders.quotation=0 \n\t\t\t\t\tAND salesorderdetails.completed" . $completed . " \n\t\t\t\t\tGROUP BY salesorders.orderno, \n\t\t\t\t\t\tdebtorsmaster.name, \n\t\t\t\t\t\tcustbranch.brname, \n\t\t\t\t\t\tsalesorders.customerref, \n\t\t\t\t\t\tsalesorders.orddate, \n\t\t\t\t\t\tsalesorders.deliverydate,  \n\t\t\t\t\t\tsalesorders.deliverto\n\t\t\t\t\tORDER BY salesorders.orderno";
                }
            }
            //end selected customer
        }
        //end not order number selected
        $SalesOrdersResult = DB_query($SQL, $db);
        if (DB_error_no($db) != 0) {
            echo '<br>' . _('No orders were returned by the SQL because') . ' ' . DB_error_msg($db);
            echo "<br>{$SQL}";
        }
    }
}
//end of which button clicked options
if (!isset($_POST['OrdersAfterDate']) or $_POST['OrdersAfterDate'] == '' or !Is_Date($_POST['OrdersAfterDate'])) {
    $_POST['OrdersAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 2, Date('d'), Date('Y')));
}
echo "<table>";
if (!isset($OrderNumber) or $OrderNumber == '') {
    echo '<tr><td>' . _('Order Number') . ':</td><td>' . "<input type='text' name='OrderNumber' maxlength =8 size=9></td><td>" . _('for all orders placed after') . ": </td><td><input type='text' name='OrdersAfterDate' maxlength =10 size=11 value=" . $_POST['OrdersAfterDate'] . "></td><td>" . "<input type='submit' name='SearchOrders' value='" . _('Search Orders') . "'></td></tr>";
    echo '<tr><td>' . _('Customer Ref') . ':</td><td>' . "<input type='text' name='CustomerRef' maxlength =8 size=9></td>\n\t\t\t<td></td><td colspan=2><input type='checkbox' " . $ShowChecked . " name='completed' />" . _('Show Completed orders only') . "</td></tr>";
}
echo '</table>';
if (!isset($SelectedStockItem)) {
    $SQL = 'SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription';
    $result1 = DB_query($SQL, $db);
    echo '<hr>';
    echo '<div class="centre"><font size=1>' . _('To search for sales orders for a specific part use the part selection facilities below') . '   </font>';
    echo '<input type="submit" name="SearchParts" value="' . _('Search Parts Now') . '">';
    if (count($_SESSION['AllowedPageSecurityTokens']) > 1) {
        echo '<input type=submit name="ResetPart" value="' . _('Show All') . '"></div>';
示例#21
0
        $DbgMsg = _('The following SQL to insert the GRN Suspense GLTrans record was used');
        $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true);
    }
    /* end of if GL and stock integrated*/
    $Result = DB_Txn_Commit();
    echo '<br />' . _('GRN number') . ' ' . $_GET['GRNNo'] . ' ' . _('for') . ' ' . $QtyToReverse . ' x ' . $GRN['itemcode'] . ' - ' . $GRN['itemdescription'] . ' ' . _('has been reversed') . '<br />';
    unset($_GET['GRNNo']);
    // to ensure it cant be done again!!
    echo '<a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">' . _('Select another GRN to Reverse') . '</a>';
    /*end of Process Goods Received Reversal entry */
} else {
    echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">';
    echo '<div>';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    if (!isset($_POST['RecdAfterDate']) or !Is_Date($_POST['RecdAfterDate'])) {
        $_POST['RecdAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date("m") - 3, Date("d"), Date("Y")));
    }
    echo '<input type="hidden" name="SupplierID" value="' . $_POST['SupplierID'] . '" />';
    echo '<input type="hidden" name="SuppName" value="' . $_POST['SuppName'] . '" />';
    echo '<table class="selection"><tr>';
    echo '<td>' . _('Show all goods received after') . ': </td>
			<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="RecdAfterDate" value="' . $_POST['RecdAfterDate'] . '" maxlength="10" size="10" /></td>
		</tr>
		</table>
		<br />
		<div class="centre">
			<input type="submit" name="ShowGRNS" value="' . _('Show Outstanding Goods Received') . '" />
		</div>';
    echo '</div>
          </form>';
    if (isset($_POST['ShowGRNS'])) {
示例#22
0
            echo '<option value="' . $myrow['currabrev'] . '">' . $myrow['currency'] . '</option>';
        }
    }
    echo '</select></td>
		</tr>';
    if (!isset($_POST['ExRate']) or !is_numeric(filter_number_format($_POST['ExRate']))) {
        $DefaultExRate = '1';
    } else {
        $DefaultExRate = filter_number_format($_POST['ExRate']);
    }
    echo '<tr>
			<td>' . _('Exchange Rate') . ':</td>
            <td><input type="text" class="number" title="' . _('The input must be number') . '" name="ExRate" maxlength="11" size="12" value="' . locale_number_format($DefaultExRate, 'Variable') . '" /></td>
          </tr>';
    if (!isset($_POST['AmountsDueBy'])) {
        $DefaultDate = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') + 1, 0, Date('y')));
    } else {
        $DefaultDate = $_POST['AmountsDueBy'];
    }
    echo '<tr>
			<td>' . _('Payments Due To') . ':</td>
            <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="AmountsDueBy" maxlength="11" size="12" value="' . $DefaultDate . '" /></td>
          </tr>';
    $SQL = "SELECT bankaccountname, accountcode FROM bankaccounts";
    $AccountsResults = DB_query($SQL, $db, '', '', false, false);
    if (DB_error_no($db) != 0) {
        echo '<br />' . _('The bank accounts could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db);
        if ($debug == 1) {
            echo '<br />' . _('The SQL used to retrieve the bank accounts was') . ':<br />' . $SQL;
        }
        exit;
if (isset($_GET['Status'])) {
    if (is_numeric($_GET['Status'])) {
        $_POST['Status'] = $_GET['Status'];
    }
} elseif (isset($_POST['Status'])) {
    if ($_POST['Status'] == '' or $_POST['Status'] == 1 or $_POST['Status'] == 0) {
        $Status = $_POST['Status'];
    } else {
        prnMsg(_('The balance status should be all or zero balance or not zero balance'), 'error');
        exit;
    }
} else {
    $_POST['Status'] = '';
}
if (!isset($_POST['TransAfterDate'])) {
    $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - $_SESSION['NumberOfMonthMustBeShown'], Date('d'), Date('Y')));
}
$SQL = "SELECT debtorsmaster.name,\n\t\tcurrencies.currency,\n\t\tcurrencies.decimalplaces,\n\t\tpaymentterms.terms,\n\t\tdebtorsmaster.creditlimit,\n\t\tholdreasons.dissallowinvoices,\n\t\tholdreasons.reasondescription,\n\t\tSUM(debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) AS balance,\n\t\tSUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN\n\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue\n\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END\n\t\tELSE\n\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END\n\t\tEND) AS due,\n\t\tSUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN\n\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue\n\t\t\tAND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays1'] . ")\n\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END\n\t\tELSE\n\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays1'] . ")\n\t\t\tTHEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount\n\t\t\t- debtortrans.alloc ELSE 0 END\n\t\tEND) AS overdue1,\n\t\tSUM(CASE WHEN (paymentterms.daysbeforedue > 0) THEN\n\t\t\tCASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue\n\t\t\tAND TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) >= (paymentterms.daysbeforedue + " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END\n\t\tELSE\n\t\t\tCASE WHEN (TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END\n\t\tEND) AS overdue2\n\t\tFROM debtorsmaster,\n\t \t\t\tpaymentterms,\n\t \t\t\tholdreasons,\n\t \t\t\tcurrencies,\n\t \t\t\tdebtortrans\n\t\tWHERE  debtorsmaster.paymentterms = paymentterms.termsindicator\n\t \t\tAND debtorsmaster.currcode = currencies.currabrev\n\t \t\tAND debtorsmaster.holdreason = holdreasons.reasoncode\n\t \t\tAND debtorsmaster.debtorno = '" . $CustomerID . "'\n\t \t\tAND debtorsmaster.debtorno = debtortrans.debtorno\n\t\t\tGROUP BY debtorsmaster.name,\n\t\t\tcurrencies.currency,\n\t\t\tpaymentterms.terms,\n\t\t\tpaymentterms.daysbeforedue,\n\t\t\tpaymentterms.dayinfollowingmonth,\n\t\t\tdebtorsmaster.creditlimit,\n\t\t\tholdreasons.dissallowinvoices,\n\t\t\tholdreasons.reasondescription";
$ErrMsg = _('The customer details could not be retrieved by the SQL because');
$CustomerResult = DB_query($SQL, $ErrMsg);
if (DB_num_rows($CustomerResult) == 0) {
    /*Because there is no balance - so just retrieve the header information about the customer - the choice is do one query to get the balance and transactions for those customers who have a balance and two queries for those who don't have a balance OR always do two queries - I opted for the former */
    $NIL_BALANCE = True;
    $SQL = "SELECT debtorsmaster.name,\n\t\t\t\t\tdebtorsmaster.currcode,\n\t\t\t\t\tcurrencies.currency,\n\t\t\t\t\tcurrencies.decimalplaces,\n\t\t\t\t\tpaymentterms.terms,\n\t\t\t\t\tdebtorsmaster.creditlimit,\n\t\t\t\t\tholdreasons.dissallowinvoices,\n\t\t\t\t\tholdreasons.reasondescription\n\t\t\tFROM debtorsmaster INNER JOIN paymentterms\n\t\t\tON debtorsmaster.paymentterms = paymentterms.termsindicator\n\t\t\tINNER JOIN currencies\n\t\t\tON debtorsmaster.currcode = currencies.currabrev\n\t\t\tINNER JOIN holdreasons\n\t\t\tON debtorsmaster.holdreason = holdreasons.reasoncode\n\t\t\tWHERE debtorsmaster.debtorno = '" . $CustomerID . "'";
    $ErrMsg = _('The customer details could not be retrieved by the SQL because');
    $CustomerResult = DB_query($SQL, $ErrMsg);
} else {
    $NIL_BALANCE = False;
}
$CustomerRecord = DB_fetch_array($CustomerResult);
if ($NIL_BALANCE == True) {
示例#24
0
    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">
			<tr>
				<td>' . _('Enter the date from which orders are to be listed') . ':</td>
				<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" autofocus="autofocus" required="required" minlength="1" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 1, Date('y'))) . '" /></td>
			</tr>';
    echo '<tr>
			<td>' . _('Enter the date to which orders are to be listed') . ':</td>
			<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" required="required" minlength="1" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td></tr>';
    echo '<tr>
			<td>' . _('Inventory Category') . '</td>
			<td>';
    $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'";
    $result = DB_query($sql, $db);
    echo '<select required="required" minlength="1" name="CategoryID">
			<option selected="selected" value="All">' . _('Over All Categories') . '</option>';
    while ($myrow = DB_fetch_array($result)) {
        echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
    }
    echo '</select></td></tr>';
    if (isset($_POST['StockLocation']) and $_POST['StockLocation'] != 'All') {
        if ($myrow['loccode'] == $_POST['StockLocation']) {
            echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        } else {
            echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        }
    } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) {
        echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
        $_POST['StockLocation'] = $myrow['loccode'];
    } else {
        echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
    }
}
echo '</select></td>';
if (!isset($_POST['OnHandDate'])) {
    $_POST['OnHandDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), 0, Date('y')));
}
echo '<td>' . _('On-Hand On Date') . ':</td>
	<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="OnHandDate" size="12" maxlength="12" value="' . $_POST['OnHandDate'] . '" /></td></tr>';
echo '<tr>
		<td colspan="6">
		<div class="centre">
		<input type="submit" name="ShowStatus" value="' . _('Show Stock Status') . '" />
		</div></td>
	</tr>
	</table>
    </div>
	</form>';
$TotalQuantity = 0;
if (isset($_POST['ShowStatus']) and Is_Date($_POST['OnHandDate'])) {
    if ($_POST['StockCategory'] == 'All') {
示例#26
0
		<th><b>' . $_SESSION['SuppTrans']->SupplierID . ' - ' . $_SESSION['SuppTrans']->SupplierName . '</b></th>
		<th><b>' . $_SESSION['SuppTrans']->CurrCode . '</b></th>
		<td><b>' . $_SESSION['SuppTrans']->TermsDescription . '</b></td>
		<td><b>' . $_SESSION['SuppTrans']->TaxGroupDescription . '</b></td>
	</tr>
	</table>';
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post" id="form1">';
echo '<div>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<br />
		<table class="selection">';
echo '<tr>
		<td style="color:red">' . _('Supplier Credit Note Reference') . ':</td>
		<td><input type="text" size="20" maxlength="20" name="SuppReference" value="' . $_SESSION['SuppTrans']->SuppReference . '" /></td>';
if (!isset($_SESSION['SuppTrans']->TranDate)) {
    $_SESSION['SuppTrans']->TranDate = Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m'), Date('d') - 1, Date('y')));
}
echo '<td style="color:red">' . _('Credit Note Date') . ' (' . _('in format') . ' ' . $_SESSION['DefaultDateFormat'] . ') :</td>
		<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" size="11" maxlength="10" name="TranDate" value="' . $_SESSION['SuppTrans']->TranDate . '" /></td>
		<td style="color:red">' . _('Exchange Rate') . ':</td>
		<td><input type="text" class="number" size="11" maxlength="10" name="ExRate" value="' . locale_number_format($_SESSION['SuppTrans']->ExRate, 'Variable') . '" /></td>
	</tr>
	</table>';
echo '<br />
	<div class="centre">
		<input type="submit" name="GRNS" value="' . _('Purchase Orders') . '"/> 
		<input type="submit" name="Shipts" value="' . _('Shipments') . '" /> 
		<input type="submit" name="Contracts" value="' . _('Contracts') . '" /> ';
if ($_SESSION['SuppTrans']->GLLink_Creditors == 1) {
    echo '<input type="submit" name="GL" value="' . _('General Ledger') . '" /> ';
}
示例#27
0
    $InputError = 1;
}
if (isset($_POST['ToDate']) and !Is_Date($_POST['ToDate'])) {
    $msg = _('The date to must be specified in the format') . ' ' . $_SESSION['DefaultDateFormat'];
    $InputError = 1;
}
if (!isset($_POST['FromDate']) or !isset($_POST['ToDate']) or $InputError == 1) {
    $title = _('Delivery In Full On Time (DIFOT) Report');
    include 'includes/header.inc';
    echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . _('DIFOT Report') . '</p>';
    echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<table class="selection">
			<tr>
				<td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td>
				<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0, 0, 0, Date('m') - 1, 0, Date('y'))) . '" /></td>
			</tr>';
    echo '<tr>
			<td>' . _('Enter the date to which variances between orders and deliveries are to be listed') . ':</td>
			<td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td>
		</tr>';
    if (!isset($_POST['DaysAcceptable'])) {
        $_POST['DaysAcceptable'] = 1;
    }
    echo '<tr><td>' . _('Enter the number of days considered acceptable between delivery requested date and invoice date(ie the date dispatched)') . ':</td>
				<td><input type="text" class="number" name="DaysAcceptable" maxlength="2" size="2" value="' . $_POST['DaysAcceptable'] . '" /></td>
			</tr>';
    echo '<tr><td>' . _('Inventory Category') . '</td><td>';
    $sql = "SELECT categorydescription,\n\t\t\t\t\tcategoryid\n\t\t\t\tFROM stockcategory\n\t\t\t\tWHERE stocktype<>'D'\n\t\t\t\t\tAND stocktype<>'L'";
    $result = DB_query($sql, $db);
    echo '<select name="CategoryID">';