From: <tim...@us...> - 2012-07-20 09:38:09
|
Revision: 5521 http://web-erp.svn.sourceforge.net/web-erp/?rev=5521&view=rev Author: tim_schofield Date: 2012-07-20 09:37:59 +0000 (Fri, 20 Jul 2012) Log Message: ----------- Added scripts to inquire on and to print General Ledger Journals Modified Paths: -------------- trunk/doc/Change.log trunk/includes/MainMenuLinksArray.php trunk/index.php trunk/sql/mysql/upgrade4.08-4.09.sql Added Paths: ----------- trunk/GLJournalInquiry.php trunk/PDFGLJournal.php trunk/companies/weberpdemo/FormDesigns/Journal.xml trunk/includes/PDFGLJournalHeader.inc Added: trunk/GLJournalInquiry.php =================================================================== --- trunk/GLJournalInquiry.php (rev 0) +++ trunk/GLJournalInquiry.php 2012-07-20 09:37:59 UTC (rev 5521) @@ -0,0 +1,127 @@ +<?php + +include ('includes/session.inc'); +$title = _('General Ledger Journal Inquiry'); +include('includes/header.inc'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p>'; + +if (!isset($_POST['Show'])) { + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<table class="selection">'; + echo '<tr><th colspan="3">' . _('Selection Criteria') . '</th></tr>'; + + $sql = "SELECT typeno FROM systypes WHERE typeid=0"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + $MaxJournalNumberUsed = $myrow['typeno']; + + echo '<tr> + <td>' . _('Journal Number Range') . ' (' . _('Between') . ' 1 ' . _('and') . ' ' . $MaxJournalNumberUsed . ')</td> + <td>' . _('From') . ':'. '<input type="text" class="number" name="NumberFrom" size="10" maxlength="11" value="1" />'.'</td> + <td>' . _('To') . ':'. '<input type="text" class="number" name="NumberTo" size="10" maxlength="11" value="' . $MaxJournalNumberUsed . '" />'.'</td> + </tr>'; + + $sql = "SELECT MIN(trandate) AS fromdate, + MAX(trandate) AS todate FROM gltrans WHERE type=0"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + if (isset($myrow['fromdate']) and $myrow['fromdate'] != '') { + $FromDate = $myrow['fromdate']; + $ToDate = $myrow['todate']; + } else { + $FromDate=date('Y-m-d'); + $ToDate=date('Y-m-d'); + } + + echo '<tr><td>' . _('Journals Dated Between') . ':</td> + <td>' . _('From') . ':'. '<input type="text" name="FromTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" value="' . ConvertSQLDate($FromDate) . '" /></td> + <td>' . _('To') . ':'. '<input type="text" name="ToTransDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" maxlength="10" size="11" value="' . ConvertSQLDate($ToDate) . '" /></td> + </tr>'; + + echo '</table>'; + echo '<br /><div class="centre"><input type="submit" name="Show" value"' . _('Show transactions'). '" /></div>'; + echo '</form>'; +} else { + + $sql="SELECT gltrans.typeno, + gltrans.trandate, + gltrans.account, + chartmaster.accountname, + gltrans.narrative, + gltrans.amount, + gltrans.tag, + tags.tagdescription, + gltrans.jobref + FROM gltrans + INNER JOIN chartmaster + ON gltrans.account=chartmaster.accountcode + LEFT JOIN tags + ON gltrans.tag=tags.tagref + WHERE gltrans.type='0' + AND gltrans.trandate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND gltrans.trandate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' + AND gltrans.typeno>='" . $_POST['NumberFrom'] . "' + AND gltrans.typeno<='" . $_POST['NumberTo'] . "' + ORDER BY gltrans.typeno"; + + $result = DB_query($sql, $db); + if (DB_num_rows($result)==0) { + prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); + } else { + echo '<table class="selection">'; + echo '<tr> + <th>' . ('Date') . '</th> + <th>'._('Journal Number').'</th> + <th>'._('Account Code').'</th> + <th>'._('Account Description').'</th> + <th>'._('Narrative').'</th> + <th>'._('Amount').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Tag').'</th> + </tr>'; + + $LastJournal = 0; + + while ($myrow = DB_fetch_array($result)){ + + if ($myrow['tag']==0) { + $myrow['tagdescription']='None'; + } + + if ($myrow['typeno']!=$LastJournal) { + echo '<tr><td colspan="8"</td></tr><tr> + <td>'. ConvertSQLDate($myrow['trandate']) . '</td> + <td class="number">'.$myrow['typeno'].'</td>'; + + } else { + echo '<tr><td colspan="2"></td>'; + } + + echo '<td>'.$myrow['account'].'</td> + <td>'.$myrow['accountname'].'</td> + <td>'.$myrow['narrative'] .'</td> + <td class="number">'.locale_number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class="number">'.$myrow['tag'] . ' - ' . $myrow['tagdescription'].'</td>'; + + if ($myrow['typeno']!=$LastJournal) { + echo '<td class="number"><a href="PDFGLJournal.php?JournalNo='.$myrow['typeno'].'">'._('Print') .'</a></td></tr>'; + + $LastJournal = $myrow['typeno']; + } else { + echo '<td colspan="1"></td></tr>'; + } + + } + echo '</table>'; + } //end if no bank trans in the range to show + + echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + echo '<br /><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '" /></div>'; + echo '</form>'; +} +include('includes/footer.inc'); + +?> \ No newline at end of file Added: trunk/PDFGLJournal.php =================================================================== --- trunk/PDFGLJournal.php (rev 0) +++ trunk/PDFGLJournal.php 2012-07-20 09:37:59 UTC (rev 5521) @@ -0,0 +1,107 @@ +<?php + +/* $Id$*/ + +/* $Revision: 1.5 $ */ + +include('includes/session.inc'); + +if (isset($_POST['JournalNo'])) { + $JournalNo=$_POST['JournalNo']; +} else if (isset($_GET['JournalNo'])) { + $JournalNo=$_GET['JournalNo']; +} else { + $JournalNo=''; +} + +if ($JournalNo=='Preview') { + $FormDesign = simplexml_load_file(sys_get_temp_dir().'/Journal.xml'); +} else { + $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/Journal.xml'); +} + +// Set the paper size/orintation +$PaperSize = $FormDesign->PaperSize; +$PageNumber=1; +$line_height=$FormDesign->LineHeight; +include('includes/PDFStarter.php'); +$pdf->addInfo('Title', _('General Ledger Journal') ); + +if ($JournalNo=='Preview') { + $LineCount = 2; // UldisN +} else { + $sql="SELECT gltrans.typeno, + gltrans.trandate, + gltrans.account, + chartmaster.accountname, + gltrans.narrative, + gltrans.amount, + gltrans.tag, + tags.tagdescription, + gltrans.jobref + FROM gltrans + INNER JOIN chartmaster + ON gltrans.account=chartmaster.accountcode + LEFT JOIN tags + ON gltrans.tag=tags.tagref + WHERE gltrans.type='0' + AND gltrans.typeno='" . $JournalNo . "'"; + $result=DB_query($sql, $db); + $LineCount = DB_num_rows($result); // UldisN + $myrow=DB_fetch_array($result); + $JournalDate=$myrow['trandate']; + DB_data_seek($result, 0); + include('includes/PDFGLJournalHeader.inc'); +} +$counter=1; +$YPos=$FormDesign->Data->y; +while ($counter<=$LineCount) { + if ($JournalNo=='Preview') { + $AccountCode=str_pad('',10,'x'); + $Date='1/1/1900'; + $Description=str_pad('',30,'x'); + $Narrative=str_pad('',30,'x'); + $Amount='XXXX.XX'; + $Tag=str_pad('',25,'x'); + $JobRef=str_pad('',25,'x'); + } else { + $myrow=DB_fetch_array($result); + if ($myrow['tag']==0) { + $myrow['tagdescription']='None'; + } + $AccountCode = $myrow['account']; + $Description = $myrow['accountname']; + $Date = $myrow['trandate']; + $Narrative = $myrow['narrative']; + $Amount = $myrow['amount']; + $Tag = $myrow['tag'].' - '.$myrow['tagdescription']; + $JobRef = $myrow['jobref']; + } + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $AccountCode); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $Description); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Narrative); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, locale_number_format($Amount,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $Tag); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$Page_Height-$YPos,$FormDesign->Data->Column6->Length,$FormDesign->Data->Column6->FontSize, $JobRef, 'left'); + $YPos += $line_height; + $counter++; + if ($YPos >= $FormDesign->LineAboveFooter->starty){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$FormDesign->Data->y; + include ('includes/PDFGrnHeader.inc'); + } //end if need a new page headed up +} + +if ($LineCount == 0) { //UldisN + $title = _('Printing Error'); + include('includes/header.inc'); + prnMsg(_('There were no Journals to print'),'warn'); + echo '<br /><a href="'.$rootpath.'/index.php">'. _('Back to the menu').'</a>'; + include('includes/footer.inc'); + exit; +} else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_Journal_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN +} +?> \ No newline at end of file Added: trunk/companies/weberpdemo/FormDesigns/Journal.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/Journal.xml (rev 0) +++ trunk/companies/weberpdemo/FormDesigns/Journal.xml 2012-07-20 09:37:59 UTC (rev 5521) @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<form name="Goods Received Note"> + <PaperSize name="Paper size">A4_Landscape</PaperSize> + <LineHeight name="Line height">12</LineHeight> + <logo type="image" name="Logo" id="Logo"> + <x>20</x> + <y>80</y> + <width>0</width> + <height>60</height> + </logo> + <CompanyName type="SimpleText" name="Company name" id="CompanyName"> + <FontSize>10</FontSize> + <x>625</x> + <y>30</y> + </CompanyName> + <GRNNumber type="SimpleText" name="GRN Number" id="GRNNumber"> + <FontSize>10</FontSize> + <x>625</x> + <y>48</y> + </GRNNumber> + <OrderNumber type="SimpleText" name="Order Number" id="OrderNumber"> + <FontSize>10</FontSize> + <x>625</x> + <y>66</y> + </OrderNumber> + <PrintDate type="SimpleText" name="Date Printed" id="PrintDate"> + <FontSize>10</FontSize> + <x>625</x> + <y>84</y> + </PrintDate> + <HeaderRectangle type="Rectangle" name="Header rectangle" id="HeaderRectangle"> + <x>40</x> + <y>114</y> + <width>772</width> + <height>24</height> + </HeaderRectangle> + <Headings type="ElementArray" name="Column headings"> + <Column1 type="SimpleText" name="Heading 1" id="Heading1"> + <FontSize>10</FontSize> + <x>41</x> + <y>126</y> + </Column1> + <Column2 type="SimpleText" name="Heading 2" id="Heading2"> + <FontSize>10</FontSize> + <x>116</x> + <y>126</y> + </Column2> + <Column3 type="SimpleText" name="Heading 3" id="Heading3"> + <FontSize>10</FontSize> + <x>256</x> + <y>126</y> + </Column3> + <Column4 type="MultiLineText" name="Heading 4" id="Heading4"> + <FontSize>10</FontSize> + <x>486</x> + <y>136</y> + <Length>100</Length> + </Column4> + <Column5 type="MultiLineText" name="Heading 5" id="Heading5"> + <FontSize>10</FontSize> + <x>616</x> + <y>136</y> + <Length>100</Length> + </Column5> + </Headings> + <DataRectangle type="Rectangle" name="Data rectangle" id="DataRectangle"> + <x>40</x> + <y>138</y> + <width>772</width> + <height>430</height> + </DataRectangle> + <LineAboveFooter type="Line" name="Line Above Footer" id="LineAboveFooter"> + <startx>40</startx> + <starty>530</starty> + <endx>812</endx> + <endy>530</endy> + </LineAboveFooter> + <Column1 type="Line" name="Column 1" id="Column1"> + <startx>114</startx> + <starty>114</starty> + <endx>114</endx> + <endy>530</endy> + </Column1> + <Column3 type="Line" name="Column 3" id="Column3"> + <startx>254</startx> + <starty>114</starty> + <endx>254</endx> + <endy>530</endy> + </Column3> + <Column4 type="Line" name="Column 4" id="Column4"> + <startx>489</startx> + <starty>114</starty> + <endx>489</endx> + <endy>530</endy> + </Column4> + <Column5 type="Line" name="Column 5" id="Column5"> + <startx>616</startx> + <starty>114</starty> + <endx>616</endx> + <endy>530</endy> + </Column5> + <Data type="ElementArray" name="Column Data"> + <y type="StartLine" name="Y co-ordinate of first data line" id="DataStartLine">156</y> + <Column1 type="DataText" name="Column 1" id="Data1"> + <FontSize>10</FontSize> + <x>41</x> + <Length>94</Length> + </Column1> + <Column2 type="DataText" name="Column 2" id="Data2"> + <FontSize>10</FontSize> + <x>116</x> + <Length>270</Length> + </Column2> + <Column3 type="DataText" name="Column 3" id="Data3"> + <FontSize>10</FontSize> + <x>256</x> + <Length>85</Length> + </Column3> + <Column4 type="DataText" name="Column 5" id="Data5"> + <FontSize>10</FontSize> + <x>568</x> + <Length>30</Length> + </Column4> + <Column5 type="DataText" name="Column 6" id="Data6"> + <FontSize>10</FontSize> + <x>638</x> + <Length>60</Length> + </Column5> + <Column6 type="DataText" name="Column 7" id="Data7"> + <FontSize>10</FontSize> + <x>700</x> + <Length>30</Length> + </Column6> + </Data> + <ReceiptDate type="SimpleText" name="Date Received" id="ReceiptDate"> + <FontSize>10</FontSize> + <x>300</x> + <y>550</y> + </ReceiptDate> + <SignedFor type="SimpleText" name="Signed Fror" id="SignedFor"> + <FontSize>10</FontSize> + <x>50</x> + <y>550</y> + </SignedFor> +</form> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2012-07-20 09:06:03 UTC (rev 5520) +++ trunk/doc/Change.log 2012-07-20 09:37:59 UTC (rev 5521) @@ -1,4 +1,5 @@ webERP Change Log +20/7/2012 Tim: Added scripts to inquire on and to print General Ledger Journals 20/7/2012 Exson: Fixed that delete or editing new serial items will lead to hyper-link changed as select credit items instead of back to credit invoice in scripts InputSerialItemsKeyed.php. Report by UK-Steven from webERP Chinese Community QQ group 15/7/12 Gilberto Dos Santos Alves: updated pt_BR.utf8 translation 13/7/12 Tim: Fix up the sql where a field was selected twice Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2012-07-20 09:06:03 UTC (rev 5520) +++ trunk/includes/MainMenuLinksArray.php 2012-07-20 09:37:59 UTC (rev 5521) @@ -348,6 +348,7 @@ _('Account Inquiry'), _('Account Listing'), _('Account Listing to CSV File'), + _('General Ledger Journal Inquiry'), _('Bank Account Reconciliation Statement'), _('Cheque Payments Listing'), _('Daily Bank Transactions'), @@ -361,6 +362,7 @@ '/SelectGLAccount.php', '/GLAccountReport.php', '/GLAccountCSV.php', + '/GLJournalInquiry.php', '/BankReconciliation.php', '/PDFChequeListing.php', '/DailyBankTransactions.php', Added: trunk/includes/PDFGLJournalHeader.inc =================================================================== --- trunk/includes/PDFGLJournalHeader.inc (rev 0) +++ trunk/includes/PDFGLJournalHeader.inc 2012-07-20 09:37:59 UTC (rev 5521) @@ -0,0 +1,36 @@ +<?php +/* $Id$*/ +/*PDF page header for price list report */ +if ($PageNumber>1){ + $pdf->newPage(); +} + +$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); + +$LeftOvers = $pdf->addText($FormDesign->CompanyName->x,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber->x,$Page_Height-$FormDesign->GRNNumber->y,$FormDesign->GRNNumber->FontSize, _('Journal number ').' ' . $JournalNo ); +$LeftOvers = $pdf->addText($FormDesign->OrderNumber->x,$Page_Height-$FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, _('Journal Date ').' ' . ConvertSQLDate($JournalDate) ); +$LeftOvers = $pdf->addText($FormDesign->PrintDate->x,$Page_Height-$FormDesign->PrintDate->y,$FormDesign->PrintDate->FontSize, _('Printed').': ' . Date($_SESSION['DefaultDateFormat']) . ' '. _('Page'). ' ' . $PageNumber); + +/*Draw a rectangle to put the headings in */ +$pdf->Rectangle($FormDesign->HeaderRectangle->x, $Page_Height - $FormDesign->HeaderRectangle->y, $FormDesign->HeaderRectangle->width,$FormDesign->HeaderRectangle->height); + +/*set up the headings */ +$LeftOvers = $pdf->addText($FormDesign->Headings->Column1->x,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, _('Account Code')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column2->x,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, _('Account Description')); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column3->x,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, _('Narrative')); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->Length, $FormDesign->Headings->Column4->FontSize, _('Amount'), 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->Length, $FormDesign->Headings->Column5->FontSize, _('Tag Details'), 'right'); + +/*Draw a rectangle to put the data in */ +$pdf->Rectangle($FormDesign->DataRectangle->x, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); + +$pdf->Line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx,$Page_Height - $FormDesign->LineAboveFooter->endy); + +$pdf->Line($FormDesign->Column1->startx, $Page_Height - $FormDesign->Column1->starty, $FormDesign->Column1->endx,$Page_Height - $FormDesign->Column1->endy); +$pdf->Line($FormDesign->Column3->startx, $Page_Height - $FormDesign->Column3->starty, $FormDesign->Column3->endx,$Page_Height - $FormDesign->Column3->endy); +$pdf->Line($FormDesign->Column4->startx, $Page_Height - $FormDesign->Column4->starty, $FormDesign->Column4->endx,$Page_Height - $FormDesign->Column4->endy); +$pdf->Line($FormDesign->Column5->startx, $Page_Height - $FormDesign->Column5->starty, $FormDesign->Column5->endx,$Page_Height - $FormDesign->Column5->endy); + +$PageNumber++; +?> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2012-07-20 09:06:03 UTC (rev 5520) +++ trunk/index.php 2012-07-20 09:37:59 UTC (rev 5521) @@ -49,7 +49,7 @@ include('includes/footer.inc'); exit; } - +echo 'x'.$PathPrefix.'x'; if (isset($_GET['Application'])){ /*This is sent by this page (to itself) when the user clicks on a tab */ $_SESSION['Module'] = $_GET['Application']; } Modified: trunk/sql/mysql/upgrade4.08-4.09.sql =================================================================== --- trunk/sql/mysql/upgrade4.08-4.09.sql 2012-07-20 09:06:03 UTC (rev 5520) +++ trunk/sql/mysql/upgrade4.08-4.09.sql 2012-07-20 09:37:59 UTC (rev 5521) @@ -14,4 +14,7 @@ ALTER TABLE `loctransfers` CHANGE `shipdate` `shipdate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'; ALTER TABLE `loctransfers` CHANGE `recdate` `recdate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'; +INSERT INTO scripts VALUES ('GLJournalInquiry.php','15','General Ledger Journal Inquiry'); +INSERT INTO scripts VALUES ('PDFGLJournal.php','15','General Ledger Journal Print'); + UPDATE config SET confvalue='4.08.2' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |