|
From: <dai...@us...> - 2017-09-08 09:45:44
|
Revision: 7828
http://sourceforge.net/p/web-erp/reponame/7828
Author: daintree
Date: 2017-09-08 09:45:40 +0000 (Fri, 08 Sep 2017)
Log Message:
-----------
Andrew Couling work on Petty cash module tax - taken from Tim fork
Modified Paths:
--------------
trunk/PcAnalysis.php
trunk/PcAssignCashTabToTab.php
trunk/PcAssignCashToTab.php
trunk/PcAuthorizeExpenses.php
trunk/PcClaimExpensesFromTab.php
trunk/PcExpenses.php
trunk/PcExpensesTypeTab.php
trunk/PcReportExpense.php
trunk/PcReportTab.php
trunk/PcTabExpensesList.php
trunk/PcTabs.php
trunk/PcTypeTabs.php
trunk/Tax.php
Modified: trunk/PcAnalysis.php
===================================================================
--- trunk/PcAnalysis.php 2017-09-08 09:40:28 UTC (rev 7827)
+++ trunk/PcAnalysis.php 2017-09-08 09:45:40 UTC (rev 7828)
@@ -23,20 +23,20 @@
$SQL = "SELECT pcexpenses.codeexpense,";
// Creation of periods SQL query
- $period_today=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
- $sqlPeriods = "SELECT periodno,
+ $PeriodToday=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
+ $SQLPeriods = "SELECT periodno,
lastdate_in_period
FROM periods
- WHERE periodno <= ". $period_today ."
+ WHERE periodno <= ". $PeriodToday ."
ORDER BY periodno DESC
LIMIT 24";
- $Periods = DB_query($sqlPeriods);
- $numPeriod = 0;
+ $Periods = DB_query($SQLPeriods);
+ $NumPeriod = 0;
$LabelsArray = array();
- while ($myrow=DB_fetch_array($Periods,$db)){
+ while ($MyRow=DB_fetch_array($Periods,$db)){
- $numPeriod++;
- $LabelsArray[$numPeriod] = MonthAndYearFromSQLDate($myrow['lastdate_in_period']);
+ $NumPeriod++;
+ $LabelsArray[$NumPeriod] = MonthAndYearFromSQLDate($MyRow['lastdate_in_period']);
$SQL = $SQL . "(SELECT SUM(pcashdetails.amount)
FROM pcashdetails
WHERE pcashdetails.codeexpense = pcexpenses.codeexpense";
@@ -43,8 +43,8 @@
if ($TabToShow!='All'){
$SQL = $SQL." AND pcashdetails.tabcode = '". $TabToShow ."'";
}
- $SQL = $SQL . " AND date >= '" . beginning_of_month($myrow['lastdate_in_period']). "'
- AND date <= '" . $myrow['lastdate_in_period'] . "') AS expense_period".$numPeriod.", ";
+ $SQL = $SQL . " AND date >= '" . beginning_of_month($MyRow['lastdate_in_period']). "'
+ AND date <= '" . $MyRow['lastdate_in_period'] . "') AS expense_period".$NumPeriod.", ";
}
// Creation of final part of SQL
$SQL = $SQL." pcexpenses.description
@@ -51,8 +51,8 @@
FROM pcexpenses
ORDER BY pcexpenses.codeexpense";
- $result = DB_query($SQL);
- if (DB_num_rows($result) != 0){
+ $Result = DB_query($SQL);
+ if (DB_num_rows($Result) != 0){
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
@@ -66,89 +66,96 @@
->setKeywords("")
->setCategory("");
- $objPHPExcel->getActiveSheet()->getStyle('1')->getAlignment()->setWrapText(true);
- $objPHPExcel->getActiveSheet()->getStyle('C:AB')->getNumberFormat()->setFormatCode('#,###');
+ // Formatting
+ $objPHPExcel->getActiveSheet()->getStyle('C:AB')->getNumberFormat()->setFormatCode('#,##0.00');
+ $objPHPExcel->getActiveSheet()->getStyle('4')->getFont()->setBold(true);
+ $objPHPExcel->getActiveSheet()->getStyle('A2')->getFont()->setBold(true);
+ $objPHPExcel->getActiveSheet()->getStyle('A:B')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+
// Add title data
$objPHPExcel->setActiveSheetIndex(0);
- $objPHPExcel->getActiveSheet()->setCellValue('A1', 'Code');
- $objPHPExcel->getActiveSheet()->setCellValue('B1', 'Description');
+ $objPHPExcel->getActiveSheet()->setCellValue('A2', 'Petty Cash Tab(s)');
+ $objPHPExcel->getActiveSheet()->setCellValue('B2', $TabToShow);
+ $objPHPExcel->getActiveSheet()->setCellValue('A4', 'Expense Code');
+ $objPHPExcel->getActiveSheet()->setCellValue('B4', 'Description');
- $objPHPExcel->getActiveSheet()->setCellValue('C1', 'Total 12 Months');
- $objPHPExcel->getActiveSheet()->setCellValue('D1', 'Average 12 Months');
+ $objPHPExcel->getActiveSheet()->setCellValue('C4', 'Total 12 Months');
+ $objPHPExcel->getActiveSheet()->setCellValue('D4', 'Average 12 Months');
- $objPHPExcel->getActiveSheet()->setCellValue('E1', $LabelsArray[24]);
- $objPHPExcel->getActiveSheet()->setCellValue('F1', $LabelsArray[23]);
- $objPHPExcel->getActiveSheet()->setCellValue('G1', $LabelsArray[22]);
- $objPHPExcel->getActiveSheet()->setCellValue('H1', $LabelsArray[21]);
- $objPHPExcel->getActiveSheet()->setCellValue('I1', $LabelsArray[20]);
- $objPHPExcel->getActiveSheet()->setCellValue('J1', $LabelsArray[19]);
- $objPHPExcel->getActiveSheet()->setCellValue('K1', $LabelsArray[18]);
- $objPHPExcel->getActiveSheet()->setCellValue('L1', $LabelsArray[17]);
- $objPHPExcel->getActiveSheet()->setCellValue('M1', $LabelsArray[16]);
- $objPHPExcel->getActiveSheet()->setCellValue('N1', $LabelsArray[15]);
- $objPHPExcel->getActiveSheet()->setCellValue('O1', $LabelsArray[14]);
- $objPHPExcel->getActiveSheet()->setCellValue('P1', $LabelsArray[13]);
- $objPHPExcel->getActiveSheet()->setCellValue('Q1', $LabelsArray[12]);
- $objPHPExcel->getActiveSheet()->setCellValue('R1', $LabelsArray[11]);
- $objPHPExcel->getActiveSheet()->setCellValue('S1', $LabelsArray[10]);
- $objPHPExcel->getActiveSheet()->setCellValue('T1', $LabelsArray[9]);
- $objPHPExcel->getActiveSheet()->setCellValue('U1', $LabelsArray[8]);
- $objPHPExcel->getActiveSheet()->setCellValue('V1', $LabelsArray[7]);
- $objPHPExcel->getActiveSheet()->setCellValue('W1', $LabelsArray[6]);
- $objPHPExcel->getActiveSheet()->setCellValue('X1', $LabelsArray[5]);
- $objPHPExcel->getActiveSheet()->setCellValue('Y1', $LabelsArray[4]);
- $objPHPExcel->getActiveSheet()->setCellValue('Z1', $LabelsArray[3]);
- $objPHPExcel->getActiveSheet()->setCellValue('AA1', $LabelsArray[2]);
- $objPHPExcel->getActiveSheet()->setCellValue('AB1', $LabelsArray[1]);
+ $objPHPExcel->getActiveSheet()->setCellValue('E4', $LabelsArray[24]);
+ $objPHPExcel->getActiveSheet()->setCellValue('F4', $LabelsArray[23]);
+ $objPHPExcel->getActiveSheet()->setCellValue('G4', $LabelsArray[22]);
+ $objPHPExcel->getActiveSheet()->setCellValue('H4', $LabelsArray[21]);
+ $objPHPExcel->getActiveSheet()->setCellValue('I4', $LabelsArray[20]);
+ $objPHPExcel->getActiveSheet()->setCellValue('J4', $LabelsArray[19]);
+ $objPHPExcel->getActiveSheet()->setCellValue('K4', $LabelsArray[18]);
+ $objPHPExcel->getActiveSheet()->setCellValue('L4', $LabelsArray[17]);
+ $objPHPExcel->getActiveSheet()->setCellValue('M4', $LabelsArray[16]);
+ $objPHPExcel->getActiveSheet()->setCellValue('N4', $LabelsArray[15]);
+ $objPHPExcel->getActiveSheet()->setCellValue('O4', $LabelsArray[14]);
+ $objPHPExcel->getActiveSheet()->setCellValue('P4', $LabelsArray[13]);
+ $objPHPExcel->getActiveSheet()->setCellValue('Q4', $LabelsArray[12]);
+ $objPHPExcel->getActiveSheet()->setCellValue('R4', $LabelsArray[11]);
+ $objPHPExcel->getActiveSheet()->setCellValue('S4', $LabelsArray[10]);
+ $objPHPExcel->getActiveSheet()->setCellValue('T4', $LabelsArray[9]);
+ $objPHPExcel->getActiveSheet()->setCellValue('U4', $LabelsArray[8]);
+ $objPHPExcel->getActiveSheet()->setCellValue('V4', $LabelsArray[7]);
+ $objPHPExcel->getActiveSheet()->setCellValue('W4', $LabelsArray[6]);
+ $objPHPExcel->getActiveSheet()->setCellValue('X4', $LabelsArray[5]);
+ $objPHPExcel->getActiveSheet()->setCellValue('Y4', $LabelsArray[4]);
+ $objPHPExcel->getActiveSheet()->setCellValue('Z4', $LabelsArray[3]);
+ $objPHPExcel->getActiveSheet()->setCellValue('AA4', $LabelsArray[2]);
+ $objPHPExcel->getActiveSheet()->setCellValue('AB4', $LabelsArray[1]);
// Add data
- $i = 2;
- while ($myrow = DB_fetch_array($result)) {
+ $i = 5;
+ while ($MyRow = DB_fetch_array($Result)) {
$objPHPExcel->setActiveSheetIndex(0);
- $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $myrow['codeexpense']);
- $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $myrow['description']);
+ $objPHPExcel->getActiveSheet()->setCellValue('A'.$i, $MyRow['codeexpense']);
+ $objPHPExcel->getActiveSheet()->setCellValue('B'.$i, $MyRow['description']);
$objPHPExcel->getActiveSheet()->setCellValue('C'.$i, '=SUM(Q'.$i.':AB'.$i.')');
$objPHPExcel->getActiveSheet()->setCellValue('D'.$i, '=AVERAGE(Q'.$i.':AB'.$i.')');
- $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, -$myrow['expense_period24']);
- $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, -$myrow['expense_period23']);
- $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, -$myrow['expense_period22']);
- $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, -$myrow['expense_period21']);
- $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, -$myrow['expense_period20']);
- $objPHPExcel->getActiveSheet()->setCellValue('J'.$i, -$myrow['expense_period19']);
- $objPHPExcel->getActiveSheet()->setCellValue('K'.$i, -$myrow['expense_period18']);
- $objPHPExcel->getActiveSheet()->setCellValue('L'.$i, -$myrow['expense_period17']);
- $objPHPExcel->getActiveSheet()->setCellValue('M'.$i, -$myrow['expense_period16']);
- $objPHPExcel->getActiveSheet()->setCellValue('N'.$i, -$myrow['expense_period15']);
- $objPHPExcel->getActiveSheet()->setCellValue('O'.$i, -$myrow['expense_period14']);
- $objPHPExcel->getActiveSheet()->setCellValue('P'.$i, -$myrow['expense_period13']);
- $objPHPExcel->getActiveSheet()->setCellValue('Q'.$i, -$myrow['expense_period12']);
- $objPHPExcel->getActiveSheet()->setCellValue('R'.$i, -$myrow['expense_period11']);
- $objPHPExcel->getActiveSheet()->setCellValue('S'.$i, -$myrow['expense_period10']);
- $objPHPExcel->getActiveSheet()->setCellValue('T'.$i, -$myrow['expense_period9']);
- $objPHPExcel->getActiveSheet()->setCellValue('U'.$i, -$myrow['expense_period8']);
- $objPHPExcel->getActiveSheet()->setCellValue('V'.$i, -$myrow['expense_period7']);
- $objPHPExcel->getActiveSheet()->setCellValue('W'.$i, -$myrow['expense_period6']);
- $objPHPExcel->getActiveSheet()->setCellValue('X'.$i, -$myrow['expense_period5']);
- $objPHPExcel->getActiveSheet()->setCellValue('Y'.$i, -$myrow['expense_period4']);
- $objPHPExcel->getActiveSheet()->setCellValue('Z'.$i, -$myrow['expense_period3']);
- $objPHPExcel->getActiveSheet()->setCellValue('AA'.$i, -$myrow['expense_period2']);
- $objPHPExcel->getActiveSheet()->setCellValue('AB'.$i, -$myrow['expense_period1']);
+ $objPHPExcel->getActiveSheet()->setCellValue('E'.$i, -$MyRow['expense_period24']);
+ $objPHPExcel->getActiveSheet()->setCellValue('F'.$i, -$MyRow['expense_period23']);
+ $objPHPExcel->getActiveSheet()->setCellValue('G'.$i, -$MyRow['expense_period22']);
+ $objPHPExcel->getActiveSheet()->setCellValue('H'.$i, -$MyRow['expense_period21']);
+ $objPHPExcel->getActiveSheet()->setCellValue('I'.$i, -$MyRow['expense_period20']);
+ $objPHPExcel->getActiveSheet()->setCellValue('J'.$i, -$MyRow['expense_period19']);
+ $objPHPExcel->getActiveSheet()->setCellValue('K'.$i, -$MyRow['expense_period18']);
+ $objPHPExcel->getActiveSheet()->setCellValue('L'.$i, -$MyRow['expense_period17']);
+ $objPHPExcel->getActiveSheet()->setCellValue('M'.$i, -$MyRow['expense_period16']);
+ $objPHPExcel->getActiveSheet()->setCellValue('N'.$i, -$MyRow['expense_period15']);
+ $objPHPExcel->getActiveSheet()->setCellValue('O'.$i, -$MyRow['expense_period14']);
+ $objPHPExcel->getActiveSheet()->setCellValue('P'.$i, -$MyRow['expense_period13']);
+ $objPHPExcel->getActiveSheet()->setCellValue('Q'.$i, -$MyRow['expense_period12']);
+ $objPHPExcel->getActiveSheet()->setCellValue('R'.$i, -$MyRow['expense_period11']);
+ $objPHPExcel->getActiveSheet()->setCellValue('S'.$i, -$MyRow['expense_period10']);
+ $objPHPExcel->getActiveSheet()->setCellValue('T'.$i, -$MyRow['expense_period9']);
+ $objPHPExcel->getActiveSheet()->setCellValue('U'.$i, -$MyRow['expense_period8']);
+ $objPHPExcel->getActiveSheet()->setCellValue('V'.$i, -$MyRow['expense_period7']);
+ $objPHPExcel->getActiveSheet()->setCellValue('W'.$i, -$MyRow['expense_period6']);
+ $objPHPExcel->getActiveSheet()->setCellValue('X'.$i, -$MyRow['expense_period5']);
+ $objPHPExcel->getActiveSheet()->setCellValue('Y'.$i, -$MyRow['expense_period4']);
+ $objPHPExcel->getActiveSheet()->setCellValue('Z'.$i, -$MyRow['expense_period3']);
+ $objPHPExcel->getActiveSheet()->setCellValue('AA'.$i, -$MyRow['expense_period2']);
+ $objPHPExcel->getActiveSheet()->setCellValue('AB'.$i, -$MyRow['expense_period1']);
$i++;
}
// Freeze panes
- $objPHPExcel->getActiveSheet()->freezePane('E2');
-
+ $objPHPExcel->getActiveSheet()->freezePane('E5');
+
// Auto Size columns
- foreach(range('A','AB') as $columnID) {
- $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)
+ for($col = 'A'; $col !== $objPHPExcel->getActiveSheet()->getHighestDataColumn(); $col++) {
+ $objPHPExcel->getActiveSheet()
+ ->getColumnDimension($col)
->setAutoSize(true);
- }
-
+}
+
// Rename worksheet
if ($TabToShow=='All'){
$objPHPExcel->getActiveSheet()->setTitle('All Accounts');
@@ -178,7 +185,7 @@
}else{
$Title = _('Excel file for Petty Cash Expenses Analysis');
include('includes/header.php');
- prnMsg('No data to analyse');
+ prnMsg('There is no data to analyse');
include('includes/footer.php');
}
}
@@ -190,6 +197,8 @@
// Display form fields. This function is called the first time
// the page is called.
$Title = _('Excel file for Petty Cash Expenses Analysis');
+ $ViewTopic = 'PettyCash';// Filename's id in ManualContents.php's TOC.
+ $BookMark = 'top';// Anchor's id in the manual's html document.
include('includes/header.php');
@@ -199,7 +208,7 @@
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text">
- <img src="' . $RootPath . '/css/' . $Theme . '/images/magnifier.png" title="' . _('Excel file for Petty Cash Expenses Analysis') . '" alt="" />' . ' ' . _('Excel file for Petty Cash Expenses Analysis') . '
+ <img src="' . $RootPath . '/css/' . $_SESSION['Theme'] . '/images/magnifier.png" title="' . _('Excel file for Petty Cash Expenses Analysis') . '" alt="" />' . ' ' . _('Excel file for Petty Cash Expenses Analysis') . '
</p>';
echo '<table class="selection">
@@ -207,15 +216,15 @@
<td>' . _('For Petty Cash Tabs') . ':</td>
<td><select name="Tabs">';
- $sql = "SELECT tabcode
+ $SQL = "SELECT tabcode
FROM pctabs
ORDER BY tabcode";
- $CatResult=DB_query($sql);
+ $CatResult = DB_query($SQL);
echo '<option value="All">' . _('All Tabs') . '</option>';
- while ($myrow=DB_fetch_array($CatResult)){
- echo '<option value="' . $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
+ while ($MyRow = DB_fetch_array($CatResult)){
+ echo '<option value="' . $MyRow['tabcode'] . '">' . $MyRow['tabcode'] . '</option>';
}
echo '</select>
</td>
@@ -235,12 +244,12 @@
} // End of function display()
-function beginning_of_month($date){
- $date2 = explode("-",$date);
- $m = $date2[1];
- $y = $date2[0];
- $first_of_month = $y . '-' . $m . '-01';
- return $first_of_month;
+function beginning_of_month($Date){
+ $Date2 = explode("-",$Date);
+ $M = $Date2[1];
+ $Y = $Date2[0];
+ $FirstOfMonth = $Y . '-' . $M . '-01';
+ return $FirstOfMonth;
}
?>
\ No newline at end of file
Modified: trunk/PcAssignCashTabToTab.php
===================================================================
--- trunk/PcAssignCashTabToTab.php 2017-09-08 09:40:28 UTC (rev 7827)
+++ trunk/PcAssignCashTabToTab.php 2017-09-08 09:45:40 UTC (rev 7828)
@@ -1,7 +1,7 @@
<?php
include('includes/session.php');
-$Title = _('Assignment of Cash From Tab To Tab');
+$Title = _('Assignment of Cash from Tab to Tab');
/* webERP manual links before header.php */
$ViewTopic= 'PettyCash';
$BookMark = 'CashAssignment';
@@ -13,6 +13,10 @@
$SelectedTabs = mb_strtoupper($_GET['SelectedTabs']);
}
+if (isset($_POST['SelectedTabsTo'])){
+ $SelectedTabsTo = mb_strtoupper($_POST['SelectedTabsTo']);
+}
+
if (isset($_POST['Days'])){
$Days = $_POST['Days'];
} elseif (isset($_GET['Days'])){
@@ -28,30 +32,30 @@
}
if (isset($_POST['Process'])) {
- if ($SelectedTabs=='') {
- prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error');
+ if ($SelectedTabs == '') {
+ prnMsg(_('You must first select a petty cash tab to assign cash'),'error');
unset($SelectedTabs);
}
- if ($SelectedTabs == mb_strtoupper($_POST['SelectedTabsTo'])) {
- prnMsg(_('The Tab selected From should not be the same as the selected To'),'error');
+ if ($SelectedTabs == $SelectedTabsTo) {
+ prnMsg(_('The tab selected FROM should not be the same as the selected TO'),'error');
unset($SelectedTabs);
- unset($_POST['SelectedTabsTo']);
+ unset($SelectedTabsTo);
unset($_POST['Process']);
}
//to ensure currency is the same
$CurrSQL = "SELECT currency
FROM pctabs
- WHERE tabcode IN ('" . $SelectedTabs . "','" . $_POST['SelectedTabsTo'] . "')";
+ WHERE tabcode IN ('" . $SelectedTabs . "','" . $SelectedTabsTo . "')";
$CurrResult = DB_query($CurrSQL);
- if (DB_num_rows($CurrResult)>0) {
+ if (DB_num_rows($CurrResult) > 0) {
$Currency = '';
while ($CurrRow = DB_fetch_array($CurrResult)) {
if ($Currency === '') {
$Currency = $CurrRow['currency'];
} elseif ($Currency != $CurrRow['currency']) {
- prnMsg (_('The currency transferred from shoud be the same with the transferred to'),'error');
+ prnMsg (_('The currency of the tab transferred from should be the same as the tab being transferred to'),'error');
unset($SelectedTabs);
- unset($_POST['SelectedTabsTo']);
+ unset($SelectedTabsTo);
unset($_POST['Process']);
}
}
@@ -61,10 +65,10 @@
if (isset($_POST['Go'])) {
$InputError = 0;
- if ($Days<=0) {
+ if ($Days <= 0) {
$InputError = 1;
prnMsg(_('The number of days must be a positive number'),'error');
- $Days=30;
+ $Days = 30;
}
}
@@ -72,39 +76,39 @@
//initialise no input errors assumed initially before we test
$InputError = 0;
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
+ echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $_SESSION['Theme'] . '/images/money_add.png" title="' .
+ _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
/* actions to take once the user has clicked the submit button
ie the page has called itself with some user input */
- $i=1;
+ $i = 1;
- if ($_POST['Amount']==0) {
+ if ($_POST['Amount'] == 0) {
$InputError = 1;
prnMsg('<br />' . _('The Amount must be input'),'error');
}
- $sqlLimit = "SELECT tablimit,tabcode
+ $SQLLimit = "SELECT tablimit,tabcode
FROM pctabs
- WHERE tabcode IN ('" . $SelectedTabs . "','" . $_POST['SelectedTabsTo'] . "')";
+ WHERE tabcode IN ('" . $SelectedTabs . "','" . $SelectedTabsTo . "')";
- $ResultLimit = DB_query($sqlLimit,$db);
- while ($LimitRow=DB_fetch_array($ResultLimit)){
+ $ResultLimit = DB_query($SQLLimit,$db);
+ while ($LimitRow = DB_fetch_array($ResultLimit)){
if ($LimitRow['tabcode'] == $SelectedTabs) {
- if (($_POST['CurrentAmount']+$_POST['Amount'])>$LimitRow['tablimit']){
+ if (($_POST['CurrentAmount'] + $_POST['Amount']) > $LimitRow['tablimit']){
$InputError = 1;
prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab') . ' ' . $LimitRow[1],'error');
}
- } elseif ($_POST['SelectedTabsToAmt'] - $_POST['Amount']>$LimitRow['tablimit']) {
+ } elseif ($_POST['SelectedTabsToAmt'] - $_POST['Amount'] > $LimitRow['tablimit']) {
$InputError = 1;
prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab') . ' ' . $LimitRow[1],'error');
}
}
- if ($InputError !=1 ) {
- // Add these 2 new record on submit
- $sql = "INSERT INTO pcashdetails
+ if ($InputError != 1) {
+ // Add these 2 new records on submit
+ $SQL = "INSERT INTO pcashdetails
(counterindex,
tabcode,
date,
@@ -116,7 +120,7 @@
receipt)
VALUES (NULL,
'" . $_POST['SelectedTabs'] . "',
- '".FormatDateForSQL($_POST['Date'])."',
+ '" . FormatDateForSQL($_POST['Date']) . "',
'ASSIGNCASH',
'" . filter_number_format($_POST['Amount']) . "',
'0000-00-00',
@@ -125,7 +129,7 @@
'" . $_POST['Receipt'] . "'
),
(NULL,
- '" . $_POST['SelectedTabsTo'] . "',
+ '" . $SelectedTabsTo . "',
'" . FormatDateForSQL($_POST['Date']) . "',
'ASSIGNCASH',
'" . filter_number_format(-$_POST['Amount']) . "',
@@ -133,12 +137,12 @@
'0',
'" . $_POST['Notes'] . "',
'" . $_POST['Receipt'] . "')";
- $msg = _('Assignment of cash from PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('to') . $_POST['SelectedTabsTo'] . ' ' . _('has been created');
+ $msg = _('Assignment of cash from PC Tab ') . ' ' . $SelectedTabs . ' ' . _('to ') . $SelectedTabsTo . ' ' . _('has been created');
}
- if ( $InputError !=1) {
+ if ( $InputError != 1) {
//run the SQL from either of the above possibilites
- $result = DB_query($sql,$db);
+ $Result = DB_query($SQL,$db);
prnMsg($msg,'success');
unset($_POST['SelectedExpense']);
unset($_POST['Amount']);
@@ -152,8 +156,8 @@
if (!isset($SelectedTabs)){
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
+ echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $_SESSION['Theme'] . '/images/money_add.png" title="' .
+ _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">';
echo '<div>';
@@ -161,39 +165,39 @@
$SQL = "SELECT tabcode
FROM pctabs
- WHERE assigner='" . $_SESSION['UserID'] . "'
+ WHERE assigner = '" . $_SESSION['UserID'] . "'
ORDER BY tabcode";
- $result = DB_query($SQL,$db);
+ $Result = DB_query($SQL,$db);
echo '<br /><table class="selection">'; //Main table
- echo '<tr><td>' . _('Petty Cash Tab To Assign Cash From') . ':</td>
+ echo '<tr><td>' . _('Petty cash tab to assign cash from') . ':</td>
<td><select name="SelectedTabs">';
- while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
+ while ($MyRow = DB_fetch_array($Result)) {
+ if (isset($_POST['SelectTabs']) AND $MyRow['tabcode'] == $_POST['SelectTabs']) {
echo '<option selected="selected" value="';
} else {
echo '<option value="';
}
- echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
+ echo $MyRow['tabcode'] . '">' . $MyRow['tabcode'] . '</option>';
}
echo '</select></td></tr>';
- echo '<tr><td>' . _('Petty Cash Tab To Assign Cash To') . ':</td>
+ echo '<tr><td>' . _('Petty cash tab to assign cash to') . ':</td>
<td><select name="SelectedTabsTo">';
- DB_data_seek($result,0);
- while ($myrow = DB_fetch_array($result)) {
- if (isset($_POST['SelectTabsTo']) AND $myrow['tabcode'] == $_POST['SelectTabs']) {
+ DB_data_seek($Result,0);
+ while ($MyRow = DB_fetch_array($Result)) {
+ if (isset($_POST['SelectTabsTo']) AND $MyRow['tabcode'] == $_POST['SelectTabs']) {
echo '<option selected="selected" value="';
} else {
echo '<option value="';
}
- echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
+ echo $MyRow['tabcode'] . '">' . $MyRow['tabcode'] . '</option>';
}
echo '</select></td></tr>';
echo '</table>'; // close main table
- DB_free_result($result);
+ DB_free_result($Result);
echo '<br />
<div class="centre">
@@ -208,13 +212,22 @@
if (isset($_POST['Process']) OR isset($SelectedTabs)) {
if (!isset($_POST['submit'])) {
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
+ echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $_SESSION['Theme'] . '/images/money_add.png" title="' .
+ _('Search') . '" alt="" />' . ' ' . $Title . '</p>';
}
- echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Select another tab') . '</a></div>';
-
-
-
+ echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Select another pair of tabs') . '</a></div>';
+
+ echo '<br /><table class="selection">';
+ echo ' <tr>
+ <td>' . _('Petty cash tab to assign cash from') . ':</td>
+ <td>' . $SelectedTabs . '</td>
+ </tr>
+ <tr>
+ <td>' . _('Petty cash tab to assign cash to') . ':</td>
+ <td>' . $SelectedTabsTo . '</td>
+ </tr>';
+ echo '</table>';
+
if (! isset($_GET['edit']) OR isset ($_POST['GO'])){
if (isset($_POST['Cancel'])) {
@@ -225,23 +238,33 @@
}
if(!isset ($Days)){
- $Days=30;
+ $Days = 30;
}
/* Retrieve decimal places to display */
- $SqlDecimalPlaces="SELECT decimalplaces
+ $SQLDecimalPlaces = "SELECT decimalplaces
FROM currencies,pctabs
WHERE currencies.currabrev = pctabs.currency
- AND tabcode='" . $SelectedTabs . "'";
- $result = DB_query($SqlDecimalPlaces,$db);
- $myrow=DB_fetch_array($result);
- $CurrDecimalPlaces = $myrow['decimalplaces'];
+ AND tabcode = '" . $SelectedTabs . "'";
+ $Result = DB_query($SQLDecimalPlaces,$db);
+ $MyRow = DB_fetch_array($Result);
+ $CurrDecimalPlaces = $MyRow['decimalplaces'];
- $sql = "SELECT * FROM pcashdetails
+ $SQL = "SELECT counterindex,
+ tabcode,
+ tag,
+ date,
+ codeexpense,
+ amount,
+ authorized,
+ posted,
+ notes,
+ receipt
+ FROM pcashdetails
WHERE tabcode='" . $SelectedTabs . "'
- AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY)
+ AND date >= DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY)
ORDER BY date, counterindex ASC";
- $result = DB_query($sql,$db);
+ $Result = DB_query($SQL,$db);
echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">
<div>
@@ -248,7 +271,7 @@
<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
<table class="selection">
<tr>
- <th colspan="8">' . _('Detail Of PC Tab Movements For Last') .':
+ <th colspan="8">' . _('Detail of Tab Movements For Last') .':
<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />
<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days') . '
<input type="submit" name="Go" value="' . _('Go') . '" /></th>
@@ -257,63 +280,70 @@
<th>' . _('Date') . '</th>
<th>' . _('Expense Code') . '</th>
<th>' . _('Amount') . '</th>
- <th>' . _('Authorised') . '</th>
<th>' . _('Notes') . '</th>
<th>' . _('Receipt') . '</th>
+ <th>' . _('Date Authorised') . '</th>
</tr>';
- $k=0; //row colour counter
+ $k = 0; //row colour counter
- while ($myrow = DB_fetch_array($result)) {
- if ($k==1){
+ while ($MyRow = DB_fetch_array($Result)) {
+ if ($k == 1){
echo '<tr class="EvenTableRows">';
- $k=0;
+ $k = 0;
} else {
echo '<tr class="OddTableRows">';
- $k=1;
+ $k = 1;
}
- $sqldes="SELECT description
+ $SQLDes="SELECT description
FROM pcexpenses
- WHERE codeexpense='". $myrow['3'] . "'";
+ WHERE codeexpense='" . $MyRow['codeexpense'] . "'";
- $ResultDes = DB_query($sqldes,$db);
- $Description=DB_fetch_array($ResultDes);
-
- if (!isset($Description['0'])){
- $Description['0']='ASSIGNCASH';
+ $ResultDes = DB_query($SQLDes,$db);
+ $Description = DB_fetch_array($ResultDes);
+ if (!isset($Description[0])) {
+ $ExpenseCodeDes = 'ASSIGNCASH';
+ } else {
+ $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0];
}
+
+ if ($MyRow['authorized'] == '0000-00-00') {
+ $AuthorisedDate = _('Unauthorised');
+ } else {
+ $AuthorisedDate = ConvertSQLDate($MyRow['authorized']);
+ }
- if (($myrow['authorized'] == '0000-00-00') and ($Description['0'] == 'ASSIGNCASH')){
+ if (($MyRow['authorized'] == '0000-00-00') AND ($Description['0'] == 'ASSIGNCASH')){
// only cash assignations NOT authorized can be modified or deleted
- echo '<td>' . ConvertSQLDate($myrow['date']) . '</td>
- <td>' . $Description['0'] . '</td>
- <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td>
- <td>' . ConvertSQLDate($myrow['authorized']) . '</td>
- <td>' . $myrow['notes'] . '</td>
- <td>' . $myrow['receipt'] . '</td>
+ echo '<td>' . ConvertSQLDate($MyRow['date']) . '</td>
+ <td>', $ExpenseCodeDes, '</td>
+ <td class="number">' . locale_number_format($MyRow['amount'],$CurrDecimalPlaces) . '</td>
+ <td>' . $MyRow['notes'] . '</td>
+ <td>' . $MyRow['receipt'] . '</td>
+ <td>' . $AuthorisedDate . '</td>
</tr>';
}else{
- echo '<td>' . ConvertSQLDate($myrow['date']) . '</td>
- <td>' . $Description['0'] . '</td>
- <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td>
- <td>' . ConvertSQLDate($myrow['authorized']) . '</td>
- <td>' . $myrow['notes'] . '</td>
- <td>' . $myrow['receipt'] . '</td>
+ echo '<td>' . ConvertSQLDate($MyRow['date']) . '</td>
+ <td>', $ExpenseCodeDes, '</td>
+ <td class="number">' . locale_number_format($MyRow['amount'],$CurrDecimalPlaces) . '</td>
+ <td>' . $MyRow['notes'] . '</td>
+ <td>' . $MyRow['receipt'] . '</td>
+ <td>' . $AuthorisedDate . '</td>
</tr>';
}
}
//END WHILE LIST LOOP
- $sqlamount="SELECT sum(amount) as amt,
+ $SQLAmount="SELECT sum(amount) as amt,
tabcode
FROM pcashdetails
- WHERE tabcode IN ('".$SelectedTabs."','" . $_POST['SelectedTabsTo'] . "')
+ WHERE tabcode IN ('" . $SelectedTabs . "','" . $SelectedTabsTo . "')
GROUP BY tabcode";
- $ResultAmount = DB_query($sqlamount,$db);
- if (DB_num_rows($ResultAmount)>0) {
- while ($AmountRow=DB_fetch_array($ResultAmount)) {
+ $ResultAmount = DB_query($SQLAmount,$db);
+ if (DB_num_rows($ResultAmount) > 0) {
+ while ($AmountRow = DB_fetch_array($ResultAmount)) {
if (is_null($AmountRow['amt'])) {
$AmountRow['amt'] = 0;
}
@@ -320,13 +350,13 @@
if ($AmountRow['tabcode'] == $SelectedTabs) {
$SelectedTab = array($AmountRow['amt'],$SelectedTabs);
} else {
- $SelectedTabsTo = array($AmountRow['amt'],$_POST['SelectedTabsTo']);
+ $SelectedTabsTo = array($AmountRow['amt'],$SelectedTabsTo);
}
}
}
if (!isset($SelectedTab)) {
$SelectedTab = array(0,$SelectedTabs);
- $SelectedTabsTo = array(0,$_POST['SelectedTabsTo']);
+ $SelectedTabsTo = array(0,$SelectedTabsTo);
}
@@ -353,7 +383,7 @@
/* Ricard: needs revision of this date initialization */
if (!isset($_POST['Date'])) {
- $_POST['Date']=Date($_SESSION['DefaultDateFormat']);
+ $_POST['Date'] = Date($_SESSION['DefaultDateFormat']);
}
echo '<br />
@@ -362,13 +392,13 @@
<th colspan="2"><h3>' . _('New Cash Assignment') . '</h3></th>
</tr>';
echo '<tr>
- <td>' . _('Cash Assignation Date') . ':</td>
- <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="Date" required="required" autofocus="autofocus" size="10" maxlength="10" value="' . $_POST['Date'] . '" /></td>
+ <td>' . _('Cash Assignment Date') . ':</td>
+ <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="Date" required="required" autofocus="autofocus" size="10" maxlength="10" value="' . $_POST['Date'] . '" /></td>
</tr>';
if (!isset($_POST['Amount'])) {
- $_POST['Amount']=0;
+ $_POST['Amount'] = 0;
}
echo '<tr>
@@ -377,7 +407,7 @@
</tr>';
if (!isset($_POST['Notes'])) {
- $_POST['Notes']='';
+ $_POST['Notes'] = '';
}
echo '<tr>
@@ -386,7 +416,7 @@
</tr>';
if (!isset($_POST['Receipt'])) {
- $_POST['Receipt']='';
+ $_POST['Receipt'] = '';
}
echo '<tr>
@@ -396,7 +426,7 @@
</table>
<input type="hidden" name="CurrentAmount" value="' . $SelectedTab['0']. '" />
<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />
- <input type="hidden" name="Days" value="' .$Days. '" />
+ <input type="hidden" name="Days" value="' . $Days . '" />
<input type="hidden" name="SelectedTabsTo" value="' . $SelectedTabsTo[1] . '" />
<input type="hidden" name="SelectedTabsToAmt" value="' . $SelectedTabsTo[0] . '" />
<br />
Modified: trunk/PcAssignCashToTab.php
===================================================================
--- trunk/PcAssignCashToTab.php 2017-09-08 09:40:28 UTC (rev 7827)
+++ trunk/PcAssignCashToTab.php 2017-09-08 09:45:40 UTC (rev 7828)
@@ -1,421 +1,392 @@
-<?php
-/* $Id$*/
-
-include('includes/session.php');
-$Title = _('Assignment of Cash to Petty Cash Tab');
-/* webERP manual links before header.php */
-$ViewTopic= 'PettyCash';
-$BookMark = 'CashAssignment';
-include('includes/header.php');
-
-if (isset($_POST['SelectedTabs'])){
- $SelectedTabs = mb_strtoupper($_POST['SelectedTabs']);
-} elseif (isset($_GET['SelectedTabs'])){
- $SelectedTabs = mb_strtoupper($_GET['SelectedTabs']);
-}
-
-if (isset($_POST['SelectedIndex'])){
- $SelectedIndex = $_POST['SelectedIndex'];
-} elseif (isset($_GET['SelectedIndex'])){
- $SelectedIndex = $_GET['SelectedIndex'];
-}
-
-if (isset($_POST['Days'])){
- $Days = $_POST['Days'];
-} elseif (isset($_GET['Days'])){
- $Days = $_GET['Days'];
-}
-
-if (isset($_POST['Cancel'])) {
- unset($SelectedTabs);
- unset($SelectedIndex);
- unset($Days);
- unset($_POST['Amount']);
- unset($_POST['Notes']);
- unset($_POST['Receipt']);
-}
-
-if (isset($_POST['Process'])) {
- if ($SelectedTabs=='') {
- prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error');
- unset($SelectedTabs);
- }
-}
-
-if (isset($_POST['Go'])) {
- $InputError = 0;
- if ($Days<=0) {
- $InputError = 1;
- prnMsg(_('The number of days must be a positive number'),'error');
- $Days=30;
- }
-}
-
-if (isset($_POST['submit'])) {
- //initialise no input errors assumed initially before we test
- $InputError = 0;
-
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
-
- /* actions to take once the user has clicked the submit button
- ie the page has called itself with some user input */
-
- $i=1;
-
- if ($_POST['Amount']==0) {
- $InputError = 1;
- prnMsg('<br />' . _('The Amount must be input'),'error');
- }
-
- $sqlLimit = "SELECT pctabs.tablimit,
- pctabs.currency,
- currencies.decimalplaces
- FROM pctabs,
- currencies
- WHERE pctabs.currency = currencies.currabrev
- AND pctabs.tabcode='" . $SelectedTabs . "'";
-
- $ResultLimit = DB_query($sqlLimit);
- $Limit=DB_fetch_array($ResultLimit);
-
- if (($_POST['CurrentAmount'])>$Limit['tablimit']){
- $InputError = 1;
- prnMsg(_('Cash NOT assigned because PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'],$Limit['decimalplaces']) . ' ' . $Limit['currency'],'error');
- prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'),'error');
- }
-
- if ($InputError !=1 AND (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit'])){
- prnMsg(_('Cash assigned but PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'],$Limit['decimalplaces']) . ' ' . $Limit['currency'],'warning');
- prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'),'warning');
- }
-
- if ($InputError !=1 AND isset($SelectedIndex) ) {
-
- $sql = "UPDATE pcashdetails
- SET date = '".FormatDateForSQL($_POST['Date'])."',
- amount = '" . filter_number_format($_POST['Amount']) . "',
- authorized = '0000-00-00',
- notes = '" . $_POST['Notes'] . "',
- receipt = '" . $_POST['Receipt'] . "'
- WHERE counterindex = '" . $SelectedIndex . "'";
- $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated');
-
- } elseif ($InputError !=1 ) {
- // Add new record on submit
- $sql = "INSERT INTO pcashdetails
- (counterindex,
- tabcode,
- date,
- codeexpense,
- amount,
- authorized,
- posted,
- notes,
- receipt)
- VALUES (NULL,
- '" . $_POST['SelectedTabs'] . "',
- '".FormatDateForSQL($_POST['Date'])."',
- 'ASSIGNCASH',
- '" . filter_number_format($_POST['Amount']) . "',
- '0000-00-00',
- '0',
- '" . $_POST['Notes'] . "',
- '" . $_POST['Receipt'] . "'
- )";
- $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created');
- }
-
- if ( $InputError !=1) {
- //run the SQL from either of the above possibilites
- $result = DB_query($sql);
- prnMsg($msg,'success');
- unset($_POST['SelectedExpense']);
- unset($_POST['Amount']);
- unset($_POST['Notes']);
- unset($_POST['Receipt']);
- unset($_POST['SelectedTabs']);
- unset($_POST['Date']);
- }
-
-} elseif ( isset($_GET['delete']) ) {
-
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
- $sql="DELETE FROM pcashdetails
- WHERE counterindex='" . $SelectedIndex . "'";
- $ErrMsg = _('The assignment of cash record could not be deleted because');
- $result = DB_query($sql,$ErrMsg);
- prnMsg(_('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted') ,'success');
- unset($_GET['delete']);
-}
-
-if (!isset($SelectedTabs)){
-
- /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters
- then none of the above are true and the list of sales types will be displayed with
- links to delete or edit each. These will call the same page again and allow update/input
- or deletion of the records*/
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" 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'] . '" />';
-
- $SQL = "SELECT tabcode, assigner
- FROM pctabs
- WHERE assigner LIKE '%" . $_SESSION['UserID'] . "%'
- ORDER BY tabcode";
-
- $result = DB_query($SQL);
-
- echo '<br /><table class="selection">'; //Main table
-
- echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td>
- <td><select name="SelectedTabs">';
- while ($myrow = DB_fetch_array($result)) {
- $Assigner = explode(',',$myrow['assigner']);
- if (in_array($_SESSION['UserID'],$Assigner)) {
- if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) {
- echo '<option selected="selected" value="';
- } else {
- echo '<option value="';
- }
- echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>';
- }
- }
-
- echo '</select></td></tr>';
- echo '</table>'; // close main table
- DB_free_result($result);
-
- echo '<br />
- <div class="centre">
- <input type="submit" name="Process" value="' . _('Accept') . '" />
- <input type="submit" name="Cancel" value="' . _('Cancel') . '" />
- </div>';
- echo '</div>
- </form>';
-}
-
-//end of ifs and buts!
-if (isset($_POST['Process']) OR isset($SelectedTabs)) {
-
- if (!isset($_POST['submit'])) {
- echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/money_add.png" title="' .
- _('Search') . '" alt="" />' . ' ' . $Title. '</p>';
- }
- echo '<br /><div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">' . _('Select another tab') . '</a></div>';
-
-
-
- if (! isset($_GET['edit']) OR isset ($_POST['GO'])){
-
- if (isset($_POST['Cancel'])) {
- unset($_POST['Amount']);
- unset($_POST['Date']);
- unset($_POST['Notes']);
- unset($_POST['Receipt']);
- }
-
- if(!isset ($Days)){
- $Days=30;
- }
-
- /* Retrieve decimal places to display */
- $SqlDecimalPlaces="SELECT decimalplaces
- FROM currencies,pctabs
- WHERE currencies.currabrev = pctabs.currency
- AND tabcode='" . $SelectedTabs . "'";
- $result = DB_query($SqlDecimalPlaces);
- $myrow=DB_fetch_array($result);
- $CurrDecimalPlaces = $myrow['decimalplaces'];
-
- $sql = "SELECT * FROM pcashdetails
- WHERE tabcode='" . $SelectedTabs . "'
- AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY)
- ORDER BY date, counterindex ASC";
- $result = DB_query($sql);
-
- echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">
- <div>
- <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />
- <table class="selection">
- <tr>
- <th colspan="8">' . _('Detail Of PC Tab Movements For Last') .':
- <input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />
- <input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days') . '
- <input type="submit" name="Go" value="' . _('Go') . '" /></th>
- </tr>
- <tr>
- <th>' . _('Date') . '</th>
- <th>' . _('Expense Code') . '</th>
- <th>' . _('Amount') . '</th>
- <th>' . _('Authorised') . '</th>
- <th>' . _('Notes') . '</th>
- <th>' . _('Receipt') . '</th>
- </tr>';
-
- $k=0; //row colour counter
-
- while ($myrow = DB_fetch_array($result)) {
- if ($k==1){
- echo '<tr class="EvenTableRows">';
- $k=0;
- } else {
- echo '<tr class="OddTableRows">';
- $k=1;
- }
-
- $sqldes="SELECT description
- FROM pcexpenses
- WHERE codeexpense='". $myrow['3'] . "'";
-
- $ResultDes = DB_query($sqldes);
- $Description=DB_fetch_array($ResultDes);
-
- if (!isset($Description['0'])){
- $Description['0']='ASSIGNCASH';
- }
-
- if (($myrow['authorized'] == '0000-00-00') and ($Description['0'] == 'ASSIGNCASH')){
- // only cash assignations NOT authorized can be modified or deleted
- echo '<td>' . ConvertSQLDate($myrow['date']) . '</td>
- <td>' . $Description['0'] . '</td>
- <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td>
- <td>' . ConvertSQLDate($myrow['authorized']) . '</td>
- <td>' . $myrow['notes'] . '</td>
- <td>' . $myrow['receipt'] . '</td>
- <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedIndex=' . $myrow['counterindex'] . '&SelectedTabs=' .
- $SelectedTabs . '&Days=' . $Days . '&edit=yes">' . _('Edit') . '</a></td>
- <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?SelectedIndex=' . $myrow['counterindex'] . '&SelectedTabs=' .
- $SelectedTabs . '&Days=' . $Days . '&delete=yes" onclick="return confirm(\'' .
- _('Are you sure you wish to delete this code and the expense it may have set up?') . '\');">' .
- _('Delete') . '</a></td>
- </tr>';
- }else{
- echo '<td>' . ConvertSQLDate($myrow['date']) . '</td>
- <td>' . $Description['0'] . '</td>
- <td class="number">' . locale_number_format($myrow['amount'],$CurrDecimalPlaces) . '</td>
- <td>' . ConvertSQLDate($myrow['authorized']) . '</td>
- <td>' . $myrow['notes'] . '</td>
- <td>' . $myrow['receipt'] . '</td>
- </tr>';
- }
- }
- //END WHILE LIST LOOP
-
- $sqlamount="SELECT sum(amount)
- FROM pcashdetails
- WHERE tabcode='".$SelectedTabs."'";
-
- $ResultAmount = DB_query($sqlamount);
- $Amount=DB_fetch_array($ResultAmount);
-
- if (!isset($Amount['0'])) {
- $Amount['0']=0;
- }
-
- echo '<tr>
- <td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td>
- <td>' . locale_number_format($Amount['0'],$CurrDecimalPlaces) . '</td></tr>';
-
- echo '</table>';
- echo '</div>
- </form>';
- }
-
- if (! isset($_GET['delete'])) {
-
- if (!isset($Amount['0'])) {
- $Amount['0']=0;
- }
-
- echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'">
- <div>
- <input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
- if ( isset($_GET['edit'])) {
-
- $sql = "SELECT * FROM pcashdetails
- WHERE counterindex='".$SelectedIndex."'";
-
- $result = DB_query($sql);
- $myrow = DB_fetch_array($result);
-
- $_POST['Date'] = ConvertSQLDate($myrow['date']);
- $_POST['SelectedExpense'] = $myrow['codeexpense'];
- $_POST['Amount'] = $myrow['amount'];
- $_POST['Notes'] = $myrow['notes'];
- $_POST['Receipt'] = $myrow['receipt'];
-
- echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />
- <input type="hidden" name="SelectedIndex" value="' . $SelectedIndex. '" />
- <input type="hidden" name="CurrentAmount" value="' . $Amount[0]. '" />
- <input type="hidden" name="Days" value="' . $Days . '" />';
- }
-
-/* Ricard: needs revision of this date initialization */
- if (!isset($_POST['Date'])) {
- $_POST['Date']=Date($_SESSION['DefaultDateFormat']);
- }
-
- echo '<br />
- <table class="selection">'; //Main table
- if (isset($_GET['SelectedIndex'])) {
- echo '<tr>
- <th colspan="2"><h3>' . _('Update Cash Assignment') . '</h3></th>
- </tr>';
- } else {
- echo '<tr>
- <th colspan="2"><h3>' . _('New Cash Assignment') . '</h3></th>
- </tr>';
- }
- echo '<tr>
- <td>' . _('Cash Assignation Date') . ':</td>
- <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="Date" required="required" autofocus="autofocus" size="10" maxlength="10" value="' . $_POST['Date'] . '" /></td>
- </tr>';
-
-
- if (!isset($_POST['Amount'])) {
- $_POST['Amount']=0;
- }
-
- echo '<tr>
- <td>' . _('Amount') . ':</td>
- <td><input type="text" class="number" name="Amount" size="12" maxlength="11" value="' . locale_number_format($_POST['Amount'],$CurrDecimalPlaces) . '" /></td>
- </tr>';
-
- if (!isset($_POST['Notes'])) {
- $_POST['Notes']='';
- }
-
- echo '<tr>
- <td>' . _('Notes') . ':</td>
- <td><input type="text" name="Notes" size="50" maxlength="49" value="' . $_POST['Notes'] . '" /></td>
- </tr>';
-
- if (!isset($_POST['Receipt'])) {
- $_POST['Receipt']='';
- }
-
- echo '<tr>
- <td>' . _('Receipt') . ':</td>
- <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '" /></td>
- </tr>
- </table>
- <input type="hidden" name="CurrentAmount" value="' . $Amount['0']. '" />
- <input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '" />
- <input type="hidden" name="Days" value="' .$Days. '" />
- <br />
- <div class="centre">
- <input type="submit" name="submit" value="' . _('Accept') . '" />
- <input type="submit" name="Cancel" value="' . _('Cancel') . '" /></div>
- </div>
- </form>';
-
- } // end if user wish to delete
-}
-
-include('includes/footer.php');
-?>
+<?php
+include('includes/session.php');
+$Title = _('Assignment of Cash to Petty Cash Tab');
+/* webERP manual links before header.php */
+$ViewTopic = 'PettyCash';
+$BookMark = 'CashAssignment';
+include('includes/header.php');
+if (isset($_POST['SelectedTabs'])) {
+ $SelectedTabs = mb_strtoupper($_POST['SelectedTabs']);
+} elseif (isset($_GET['SelectedTabs'])) {
+ $SelectedTabs = mb_strtoupper($_GET['SelectedTabs']);
+}
+if (isset($_POST['SelectedIndex'])) {
+ $SelectedIndex = $_POST['SelectedIndex'];
+} elseif (isset($_GET['SelectedIndex'])) {
+ $SelectedIndex = $_GET['SelectedIndex'];
+}
+if (isset($_POST['Days'])) {
+ $Days = $_POST['Days'];
+} elseif (isset($_GET['Days'])) {
+ $Days = $_GET['Days'];
+}
+if (isset($_POST['Cancel'])) {
+ unset($SelectedTabs);
+ unset($SelectedIndex);
+ unset($Days);
+ unset($_POST['Amount']);
+ unset($_POST['Notes']);
+ unset($_POST['Receipt']);
+}
+if (isset($_POST['Process'])) {
+ if ($SelectedTabs == '') {
+ prnMsg(_('You must first select a petty cash tab to assign cash'), 'error');
+ unset($SelectedTabs);
+ }
+}
+if (isset($_POST['Go'])) {
+ $InputError = 0;
+ if ($Days <= 0) {
+ $InputError = 1;
+ prnMsg(_('The number of days must be a positive number'), 'error');
+ $Days = 30;
+ }
+}
+if (isset($_POST['submit'])) {
+ //initialise no input errors assumed initially before we test
+ $InputError = 0;
+ echo '<p class="page_title_text">
+ <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', _('Search'), '" alt="" />', ' ', $Title, '
+ </p>';
+ /* actions to take once the user has clicked the submit button
+ ie the page has called itself with some user input */
+ if ($_POST['Amount'] == 0) {
+ $InputError = 1;
+ prnMsg('<br />' . _('The Amount must be input'), 'error');
+ }
+ $SQLLimit = "SELECT pctabs.tablimit,
+ pctabs.currency,
+ currencies.decimalplaces
+ FROM pctabs,
+ currencies
+ WHERE pctabs.currency = currencies.currabrev
+ AND pctabs.tabcode='" . $SelectedTabs . "'";
+ $ResultLimit = DB_query($SQLLimit);
+ $Limit = DB_fetch_array($ResultLimit);
+ if (($_POST['CurrentAmount']) > $Limit['tablimit']){
+ $InputError = 1;
+ prnMsg(_('Cash NOT assigned because PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'error');
+ prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'error');
+ }
+ if ($InputError !=1 and (($_POST['CurrentAmount'] + $_POST['Amount']) > $Limit['tablimit'])) {
+ prnMsg(_('Cash assigned but PC tab current balance is over its cash limit of') . ' ' . locale_number_format($Limit['tablimit'], $Limit['decimalplaces']) . ' ' . $Limit['currency'], 'warning');
+ prnMsg(_('Report expenses before being allowed to assign more cash or ask the administrator to increase the limit'), 'warning');
+ }
+ if ($InputError != 1 and isset($SelectedIndex)) {
+ $SQL = "UPDATE pcashdetails
+ SET date = '" . FormatDateForSQL($_POST['Date']) . "',
+ amount = '" . filter_number_format($_POST['Amount']) . "',
+ authorized = '0000-00-00',
+ notes = '" . $_POST['Notes'] . "',
+ receipt = '" . $_POST['Receipt'] . "'
+ WHERE counterindex = '" . $SelectedIndex . "'";
+ $Msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated');
+ } elseif ($InputError != 1) {
+ // Add new record on submit
+ $SQL = "INSERT INTO pcashdetails
+ (counterindex,
+ tabcode,
+ date,
+ codeexpense,
+ amount,
+ authorized,
+ posted,
+ notes,
+ receipt)
+ VALUES (NULL,
+ '" . $_POST['SelectedTabs'] . "',
+ '" . FormatDateForSQL($_POST['Date']) . "',
+ 'ASSIGNCASH',
+ '" . filter_number_format($_POST['Amount']) . "',
+ '0000-00-00',
+ '0',
+ '" . $_POST['Notes'] . "',
+ '" . $_POST['Receipt'] . "'
+ )";
+ $Msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created');
+ }
+ if ($InputError != 1) {
+ //run the SQL from either of the above possibilites
+ $Result = DB_query($SQL);
+ prnMsg($Msg, 'success');
+ unset($_POST['SelectedExpense']);
+ unset($_POST['Amount']);
+ unset($_POST['Notes']);
+ unset($_POST['Receipt']);
+ unset($_POST['SelectedTabs']);
+ unset($_POST['Date']);
+ }
+} elseif (isset($_GET['delete'])) {
+ echo '<p class="page_title_text">
+ <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', _('Search'), '" alt="" />', ' ', $Title, '
+ </p>';
+ $SQL = "DELETE FROM pcashdetails
+ WHERE counterindex='" . $SelectedIndex . "'";
+ $ErrMsg = _('The assignment of cash record could not be deleted because');
+ $Result = DB_query($SQL, $ErrMsg);
+ prnMsg(_('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been deleted'), 'success');
+ unset($_GET['delete']);
+}
+if (!isset($SelectedTabs)) {
+ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedTabs will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters
+ then none of the above are true and the list of sales types will be displayed with
+ links to delete or edit each. These will call the same page again and allow update/input
+ or deletion of the records*/
+ echo '<p class="page_title_text">
+ <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', _('Search'), '" alt="" />', ' ', $Title, '
+ </p>';
+ echo '<form method="post" action="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '">';
+ echo '<input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />';
+ $SQL = "SELECT tabcode
+ FROM pctabs
+ WHERE assigner='" . $_SESSION['UserID'] . "'
+ ORDER BY tabcode";
+ $Result = DB_query($SQL);
+ echo '<table class="selection">
+ <tr>
+ <td>', _('Assign cash to petty cash tab'), ':</td>
+ <td><select name="SelectedTabs">';
+ while ($MyRow = DB_fetch_array($Result)) {
+ if (isset($_POST['SelectTabs']) and $MyRow['tabcode'] == $_POST['SelectTabs']) {
+ echo '<option selected="selected" value="', $MyRow['tabcode'], '">', $MyRow['tabcode'], '</option>';
+ } else {
+ echo '<option value="', $MyRow['tabcode'], '">', $MyRow['tabcode'], '</option>';
+ }
+ }
+ echo '</select>
+ </td>
+ </tr>';
+ echo '</table>'; // close main table
+ echo '<div class="centre">
+ <input type="submit" name="Process" value="', _('Accept'), '" />
+ <input type="submit" name="Cancel" value="', _('Cancel'), '" />
+ </div>';
+ echo '</form>';
+}
+//end of ifs and buts!
+if (isset($_POST['Process']) or isset($SelectedTabs)) {
+ if (!isset($_POST['submit'])) {
+ echo '<p class="page_title_text">
+ <img src="', $RootPath, '/css/', $_SESSION['Theme'], '/images/money_add.png" title="', _('Search'), '" alt="" />', ' ', $Title, '
+ </p>';
+ }
+ echo '<div class="centre">
+ <a href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '">', _('Select another tab'), '</a>
+ </div>';
+
+ echo '<br /><table class="selection">';
+ echo ' <tr>
+ <td>' . _('Petty Cash Tab') . ':</td>
+ <td>' . $SelectedTabs . '</td>
+ </tr>';
+ echo '</table>';
+
+ if (!isset($_GET['edit']) or isset($_POST['GO'])) {
+ if (isset($_POST['Cancel'])) {
+ unset($_POST['Amount']);
+ unset($_POST['Date']);
+ unset($_POST['Notes']);
+ unset($_POST['Receipt']);
+ }
+ if (!isset($Days)) {
+ $Days = 30;
+ }
+ /* Retrieve decimal places to display */
+ $SqlDecimalPlaces = "SELECT decimalplaces
+ FROM currencies,pctabs
+ WHERE currencies.currabrev = pctabs.currency
+ AND tabcode='" . $SelectedTabs . "'";
+ $Result = DB_query($SqlDecimalPlaces);
+ $MyRow = DB_fetch_array($Result);
+ $CurrDecimalPlaces = $MyRow['decimalplaces'];
+ $SQL = "SELECT counterindex,
+ tabcode,
+ tag,
+ date,
+ codeexpense,
+ amount,
+ authorized,
+ posted,
+ notes,
+ receipt
+ FROM pcashdetails
+ WHERE tabcode='" . $SelectedTabs . "'
+ AND date >=DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY)
+ ORDER BY date,
+ counterindex ASC";
+ $Result = DB_query($SQL);
+ 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>
+ <th colspan="8">', _('Detail of Tab Movements For Last'), ':
+ <input type="hidden" name="SelectedTabs" value="', $SelectedTabs, '" />
+ <input type="text" class="number" name="Days" value="', $Days, '" required="required" maxlength="3" size="4" />' . _('Days') . '
+ <input type="submit" name="Go" value="' . _('Go') . '" /></th>
+ </th>
+ </tr>
+ <tr>
+ <th>', _('Date'), '</th>
+ <th>', _('Expense Code'), '</th>
+ <th>', _('Amount'), '</th>
+ <th>', _('Notes'), '</th>
+ <th>', _('Receipt'), '</th>
+ <th>', _('Date Authorised'), '</th>
+ </tr>';
+ $k = 0; //row colour counter
+ while ($MyRow = DB_fetch_array($Result)) {
+ if ($k == 1) {
+ echo '<tr class="EvenTableRows">';
+ $k = 0;
+ } else {
+ echo '<tr class="OddTableRows">';
+ $k = 1;
+ }
+
+ $SQLdes = "SELECT description
+ FROM pcexpenses
+ WHERE codeexpense='" . $MyRow['codeexpense'] . "'";
+ $ResultDes = DB_query($SQLdes);
+ $Description = DB_fetch_array($ResultDes);
+ if (!isset($Description[0])) {
+ $ExpenseCodeDes = 'ASSIGNCASH';
+ } else {
+ $ExpenseCodeDes = $MyRow['codeexpense'] . ' - ' . $Description[0];
+ }
+
+ if ($MyRow['authorized'] == '0000-00-00') {
+ $AuthorisedDate = _('Unauthorised');
+ } else {
+ $AuthorisedDate = ConvertSQLDate($MyRow['authorized']);
+ }
+
+ if (($MyRow['authorized'] == '0000-00-00') and ($Description['0'] == 'ASSIGNCASH')) {
+ // only cash assignations NOT authorized can be modified or deleted
+ echo '<td>', ConvertSQLDate($MyRow['date']), '</td>
+ <td>', $ExpenseCodeDes, '</td>
+ <td class="number">', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '</td>
+ <td>', $MyRow['notes'], '</td>
+ <td>', $MyRow['receipt'], '</td>
+ <td>', $AuthorisedDate, '</td>
+ <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '?SelectedIndex=', $MyRow['counterindex'], '&SelectedTabs=', $SelectedTabs, '&Days=', $Days, '&edit=yes">', _('Edit'), '</a></td>
+ <td><a href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '?SelectedIndex=', $MyRow['counterindex'], '&SelectedTabs=', $SelectedTabs, '&Days=', $Days, '&delete=yes" onclick="return confirm(\'', _('Are you sure you wish to delete this code and the expense it may have set up?'), '\', \'Confirm Delete\', this);">', _('Delete'), '</a></td>
+ </tr>';
+ } else {
+ echo '<td>', ConvertSQLDate($MyRow['date']), '</td>
+ <td>', $ExpenseCodeDes, '</td>
+ <td class="number">', locale_number_format($MyRow['amount'], $CurrDecimalPlaces), '</td>
+ <td>', $MyRow['notes'], '</td>
+ <td>', $MyRow['receipt'], '</td>
+ <td>', $AuthorisedDate, '</td>
+ </tr>';
+ }
+ }
+ //END WHILE LIST LOOP
+ $SQLamount = "SELECT sum(amount)
+ FROM pcashdetails
+ WHERE tabcode='" . $SelectedTabs . "'";
+ $ResultAmount = DB_query($SQLamount);
+ $Amount = DB_fetch_array($ResultAmount);
+ if (!isset($Amount['0'])) {
+ $Amount['0'] = 0;
+ }
+ echo '<tr>
+ <td colspan="2" style="text-align:right">', _('Current balance'), ':</td>
+ <td class="number">', locale_number_format($Amount['0'], $CurrDecimalPlaces), '</td>
+ </tr>';
+ echo '</table>
+ </form>';
+ }
+ if (!isset($_GET['delete'])) {
+ if (!isset($Amount['0'])) {
+ $Amount['0'] = 0;
+ }
+ echo '<form method="post" action="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '">';
+ echo '<input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />';
+ if (isset($_GET['edit'])) {
+ /* Retrieve decimal places to display */
+ $SqlDecimalPlaces = "SELECT decimalplaces
+ FROM currencies,pctabs
+ WHERE currencies.currabrev = pctabs.currency
+ AND tabcode='" . $SelectedTabs . "'";
+ $Result = DB_query($SqlDecimalPlaces);
+ $MyRow = DB_fetch_array($Result);
+ $CurrDecimalPlaces = $MyRow['decimalplaces'];
+ $SQL = "SELECT counterindex,
+ tabcode,
+ tag,
+ date,
+ codeexpense,
+ amount,
+ authorized,
+ posted,
+ notes,
+ receipt
+ FROM pcashdetails
+ WHERE counterindex='" . $SelectedIndex . "'";
+ $Result = DB_query($SQL);
+ $MyRow = DB_fetch_array($Result);
+ $_POST['Date'] = ConvertSQLDate($MyRow['date']);
+ $_POST['Selecte...
[truncated message content] |