3 /*The supplier transaction uses the SuppTrans class to hold the information about the invoice
4 the SuppTrans class contains an array of GRNs objects - containing details of GRNs for invoicing and also
5 an array of GLCodes objects - only used if the AP - GL link is effective */
7 include('includes/DefineSuppTransClass.php');
8 /* Session started in header.inc for password checking and authorisation level check */
9 include('includes/session.inc');
11 $title = _('Supplier Invoice General Ledger Analysis');
13 include('includes/header.inc');
16 if (!isset($_SESSION['SuppInv'])){
17 prnMsg( _('To enter a supplier invoice the supplier must first be selected from the supplier selection screen') . ', ' . _('then the link to enter a supplier invoice must be clicked on'),'info');
18 echo '<BR><A HREF="' . $rootpath . '/SelectSupplier.php?' . SID
. '">' . _('Select A Supplier to Enter an Invoice For') . '</A>';
19 include('includes/footer.inc');
21 /*It all stops here if there aint no supplier selected and invoice initiated ie $_SESSION['SuppInv'] started off*/
24 /*If the user hit the Add to Invoice button then process this first before showing all GL codes on the invoice otherwise it wouldnt show the latest addition*/
26 if (isset($_POST['AddGLCodeToInvoice']) ){
30 if ($InputError==False){
31 $_SESSION['SuppInv']->Add_GLCodes_To_Trans($GLCode,
39 if (isset($_GET['Delete'])){
41 $_SESSION['SuppInv']->Remove_GLCodes_From_Trans($_GET['Delete']);
46 /*Show all the selected GLCodes so far from the SESSION['SuppInv']->GLCodes array */
47 echo '<CENTER><FONT SIZE=4 COLOR=BLUE>' . _('General Ledger Analysis of Invoice From') . ' ' . $_SESSION['SuppInv']->SupplierName
;
48 echo '<TABLE CELLPADDING=2><TR><TD class="tableheader">' . _('Account') . '</TD>
49 <TD class="tableheader">' . _('Name') . '</TD>
50 <TD class="tableheader">' . _('Amount') . '<BR>' . _('in') . ' ' . $_SESSION['SuppInv']->CurrCode
. '</TD>
51 <TD class="tableheader">' . _('Shipment') . '</TD>
52 <TD class="tableheader">' . _('Job') . '</TD>
53 <TD class="tableheader">' . _('Narrative') . '</TD></TR>';
57 foreach ($_SESSION['SuppInv']->GLCodes
as $EnteredGLCode){
59 echo '<TR><TD>' . $EnteredGLCode->GLCode
. '</TD>
60 <TD>' . $EnteredGLCode->GLActName
. '</TD>
61 <TD ALIGN=RIGHT>' . number_format($EnteredGLCode->Amount
,2) . '</TD>
62 <TD>' . $EnteredGLCode->ShiptRef
. '</TD>
63 <TD>' .$EnteredGLCode->JobRef
. '</TD>
64 <TD>' . $EnteredGLCode->Narrative
. '</TD>
65 <TD><A HREF="' . $_SERVER['PHP_SELF'] . '?' . SID
. '&Delete=' . $EnteredGLCode->Counter
. '">' . _('Delete') . '</A></TD></TR>';
67 $TotalGLValue = $TotalGLValue +
($EnteredGLCode->ChgPrice
* $EnteredGLCode->This_QuantityInv
);
72 echo '<TR><TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Account') . '</B></TD>
73 <TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Name') . '</B></TD>
74 <TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Amount') . '<BR>' . _('in') . ' ' . $_SESSION['SuppInv']->CurrCode
. '</B></TD>
75 <TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Shipment') . '</B></TD>
76 <TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Job') . '</B></TD>
77 <TD BGCOLOR=#800000><FONT COLOR=#ffffff><B>' . _('Narrative') . '</B></TD></TR>';
81 echo '<TR><TD COLSPAN=2 ALIGN=RIGHT><FONT SIZE=4 COLOR=BLUE>' . _('Total') . ':</FONT></TD>
82 <TD ALIGN=RIGHT><FONT SIZE=4 COLOR=BLUE><U>' . number_format($TotalGLValue,2) . '</U></FONT></TD></TR>';
83 echo '</TABLE><BR><A HREF="' . $rootpath . '/SupplierInvoice.php?' . SID
. '">' . _('Back to Invoice Entry') . '</A><HR>';
85 /*Set up a form to allow input of new GL entries */
86 echo '<FORM ACTION="' . $_SERVER['PHP_SELF'] . '?' . SID
. '" METHOD=POST>';
89 include('includes/footer.inc');