function slct() { db_conn(YR_DB); $sql = "SELECT * FROM info WHERE prdname !=''"; $prdRslt = db_exec($sql); if (pg_numrows($prdRslt) < 1) { return "<li class='err'>ERROR : There are no periods set for the current year.</li>"; } $Prds = "<select name='prd'>"; while ($prd = pg_fetch_array($prdRslt)) { if ($prd['prddb'] == PRD_DB) { $sel = "selected"; } else { $sel = ""; } $Prds .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>"; } $Prds .= "</select>"; db_connect(); $supplier_drop = "<select name='supplier'>"; $supplier_drop .= "<option value='0'>All Suppliers</option>"; $get_supps = "SELECT * FROM suppliers WHERE blocked IS NULL or blocked != 'yes' ORDER BY supname"; $run_supps = db_exec($get_supps) or errDie("Unable to get supplier information"); if (pg_numrows($run_supps) > 0) { while ($sarr = pg_fetch_array($run_supps)) { $supplier_drop .= "<option value='{$sarr['supid']}'>{$sarr['supname']}</option>"; } } $supplier_drop .= "</select>"; //layout $slct = "\n\t\t<h3>View Returned Stock Orders</h3>\n\t\t<table " . TMPL_tblDflts . " width='500'>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='view'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>By Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center' colspan='2' nowrap>\n\t\t\t\t\t" . mkDateSelect("from", date("Y"), date("m"), "01") . "\n\t\t\t\t\t TO \n\t\t\t\t\t" . mkDateSelect("to") . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>Supplier(s)</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td align='center'>{$supplier_drop}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Search'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<p>\n\t\t<table border=0 cellpadding='2' cellspacing='1'>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='purchase-new.php'>New Purchase</a></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><a href='purchase-view.php'>View Purchases</a></td>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>"; return $slct; }
function enter($errors = "") { extract($_REQUEST); $fields = array(); $fields["asset_id"] = 0; $fields["ex_year"] = date("Y"); $fields["ex_month"] = date("m"); $fields["ex_day"] = date("d"); $fields["description"] = ""; $fields["notes"] = ""; $fields["qty"] = 1; extract($fields, EXTR_SKIP); // Create asset dropdown $sql = "SELECT id, des, serial FROM cubit.assets ORDER BY des ASC"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $asset_sel = "<select name='asset_id' style='width='100%'>"; while ($asset_data = pg_fetch_array($asset_rslt)) { if (!isOurs($asset_data["id"]) || isHired($asset_data["id"], date("Y-m-d"))) { continue; } if ($asset_id == $asset_data["id"]) { $sel = "selected='selected'"; } else { $sel = ""; } $asset_sel .= "\r\n\t\t<option value='{$asset_data['id']}' {$sel}>\r\n\t\t\t({$asset_data['serial']}) {$asset_data['des']}\r\n\t\t</option>"; } $asset_sel .= "</select>"; $OUTPUT = "<h3>Book Asset to Workshop</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<input type='hidden' name='key' value='confirm' />\r\n\t<input type='hidden' name='qty' value='{$qty}' />\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<td colspan='2'>{$errors}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th colspan='2'>Details</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>Asset</td>\r\n\t\t\t<td>{$asset_sel}</td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>Expected Back Date</td>\r\n\t\t\t<td>" . mkDateSelect("ex", $ex_year, $ex_month, $ex_day) . "</td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>Description</td>\r\n\t\t\t<td><input type='text' name='description' value='{$description}' /></td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>Notes</td>\r\n\t\t\t<td><textarea name='notes' rows='5' cols='20'>{$notes}</textarea></td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<td colspan='2' align='right'>\r\n\t\t\t\t<input type='submit' value='Write »' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>"; return $OUTPUT; }
function confirm_emp($_GET, $err = "") { extract($_GET); $empnum += 0; db_connect(); # get employee info to edit $sql = "SELECT * FROM employees WHERE empnum='{$empnum}' AND div = '" . USER_DIV . "'"; $empRslt = db_exec($sql) or errDie("Unable to select employee info from database."); if (pg_numrows($empRslt) < 1) { return "Invalid emp number."; } $myEmpl = pg_fetch_array($empRslt); if ($myEmpl['resident'] == "t") { $myEmpl['resident'] = "Yes"; } else { $myEmpl['resident'] = "No"; } if ($myEmpl['sex'] == "M") { $myEmpl['sex'] = "Male"; } else { $myEmpl['sex'] = "Female"; } # Set up table & form $confirmEmp = "\n\t\t<h3>Confirm Remove Employee</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t{$err}\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm_rem'>\n\t\t\t<input type='hidden' name='empnum' value='{$myEmpl['empnum']}'>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th colspan='2'>Employee Details</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Surname</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['sname']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>First Names</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['fnames']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Sex</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['sex']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Marital Status</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['marital']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Resident</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['resident']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Hire Date</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['hiredate']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Telephone No</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['telno']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>E-mail</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['email']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Basic Salary</td>\n\t\t\t\t\t\t\t<td valign='center'>" . CUR . " {$myEmpl['basic_sal']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Pay Type</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['paytype']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Bank Name</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['bankname']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Branch Code</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['bankcode']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Bank Account Type</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['bankacctype']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Bank Account No</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['bankaccno']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th colspan='2'>Employee Details</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Residential Address</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['res1']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['res2']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['res3']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['res4']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Postal Address</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['pos1']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['pos2']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Postal Code</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['pcode']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th colspan='2'>Friend Not Living With Employee</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Surname</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['contsname']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>First Names</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['contfnames']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Residential Address</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['contres1']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['contres2']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td><br></td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['contres3']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Telephone No</td>\n\t\t\t\t\t\t\t<td valign='center'>{$myEmpl['conttelno']}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Details</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Reason for Leaving</td>\n\t\t\t\t<td><input type='text' size='20' name='reason'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Date</td>\n\t\t\t\t<td>" . mkDateSelect("date") . "</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Select one or more of the following</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Employee Initiated:</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='dissat_payben' value='yes'> Dissatisfaction with Pay or Benefits</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='dissat_jobcon' value='yes'> Dissatisfaction with Job Content</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='dissat_env' value='yes'> Dissatisfaction with Working Environment</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='emigration' value='yes'> Emigration</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='incom_supman' value='yes'> Incompatibility with Supervisor or Manager</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='incom_orgcul' value='yes'> Incompatibility with Organisational Culture</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='incom_collea' value='yes'> Incompatibility with Colleagues</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='lack_perdev' value='yes'> Lack of Personal Development Opportunities</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='lack_caradv' value='yes'> Lack of Career Advancement Oppertunities</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='lack_recogn' value='yes'> Lack of Recognition</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='lack_culsen' value='yes'> Lack of Cultural Sensitivity</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='self_empl' value='yes'> Self Employment</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='unsuit_locorg' value='yes'> Unsuitable Geographic Location of Organisation</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Employer Instigated:</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='redundantretrench' value='yes'> Redundancy or Retrenchment</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='dismissmisconduct' value='yes'> Dismissal or Misconduct</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='incapablepoorperc' value='yes'> Incapacity or Poor Performance</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='negosettle' value='yes'> Negotiated Settlement</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='desertion' value='yes'> Desertion</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Unavoidable Separations:</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='death' value='yes'> Death</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='retirement' value='yes'> Retirement</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='illhealth' value='yes'> Ill Health</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='pregnan' value='yes'> Pregnancy</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='famcircums' value='yes'> Family Circumstances</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><input type='checkbox' name='intercomptrans' value='yes'> Inter Company or Group Transfer</td>\n\t\t\t</tr>\n\t\t\t<tr><td><br></td></tr>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Details</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2'><textarea name='description' rows='5' cols='65'></textarea></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td><br></td>\n\t\t\t\t<td align='right'><input type='submit' value='Confirm »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>" . mkQuickLinks(ql("../admin-employee-add.php", "Add Employee"), ql("../admin-employee-view.php", "View Employees")); return $confirmEmp; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "\n\t\tSELECT invnum, cusname, odate, timestamp\n\t\tFROM cubit.invoices\n\t\tLEFT JOIN cubit.pslip_dispatched\n\t\t\tON invoices.invid=pslip_dispatched.invid\n\t\tWHERE signed='0' AND dispatched='1' AND (timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59')\n\t\tORDER BY invnum DESC"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices."); $inv_out = ""; while ($inv_data = pg_fetch_array($inv_rslt)) { $inv_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$inv_data['timestamp']}</td>\n\t\t\t\t<td>{$inv_data['invnum']}</td>\n\t\t\t\t<td>{$inv_data['cusname']}</td>\n\t\t\t\t<td>{$inv_data['odate']}</td>\n\t\t\t</tr>"; } if (empty($inv_out)) { $inv_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='4'><li>No results found</li></td>\n\t\t\t</tr>"; } $OUTPUT = "\n\t\t<center>\n\t\t<h3>Unsigned Invoices Report</h3>\n\t\t<form method='POST' action='" . SELF . "'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='4'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td> <b>To</b> </td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Time</th>\n\t\t\t\t<th>Invoice No</th>\n\t\t\t\t<th>Customer</th>\n\t\t\t\t<th>Invoice Date</th>\n\t\t\t</tr>\n\t\t\t{$inv_out}\n\t\t</table>\n\t\t</center>"; return $OUTPUT; }
function slct($_GET) { # get vars extract($_GET); # validate input require_lib("validate"); $v = new validate(); $v->isOk($supid, "num", 1, 20, "Invalid supplier number."); # display errors, if any $err = ""; if ($v->isError()) { $errors = $v->getErrors(); foreach ($errors as $e) { $err .= "<li class='err'>" . $e["msg"] . "</li>"; } return $err; } # Get selected supplier info db_connect(); $sql = "SELECT * FROM suppliers WHERE supid = '{$supid}' AND div = '" . USER_DIV . "'"; $suppRslt = db_exec($sql) or errDie("Unable to view Suppleir"); if (pg_numrows($suppRslt) < 1) { return "<li class='err'>Invalid supplier Number.</li>"; } $supp = pg_fetch_array($suppRslt); //layout $slct = "\r\n\t\t<h3>Supplier Reconciliation Statement<h3>\r\n\t\t<table " . TMPL_tblDflts . " width='580'>\r\n\t\t<form action='" . SELF . "' method='POST' name='form'>\r\n\t\t\t<input type='hidden' name='key' value='view'>\r\n\t\t\t<input type='hidden' name='supid' value='{$supid}'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Supplier</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td class='" . bg_class() . "'>{$supp['supname']}</td>\r\n\t\t\t</tr>\r\n\t\t\t<tr><td><br></td></tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>By Date Range</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'>\r\n\t\t\t\t\t" . mkDateSelect("from", date("Y"), date("m"), "01") . "\r\n\t\t\t\t\t TO \r\n\t\t\t\t\t" . mkDateSelect("to") . "\r\n\t\t\t\t</td>\r\n\t\t\t\t<td valign='bottom'><input type='submit' value='Search'></td>\r\n\t\t\t</tr>\r\n\t\t</form>\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<input type='button' value='[X] Close' onClick='javascript:parent.window.close();'>"; return $slct; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = "01"; $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT timestamp, stkcod, stkdes, qty\n\t\t\tFROM cubit.stock_take_report\n\t\t\t\tLEFT JOIN cubit.stock ON stock_take_report.stkid=stock.stkid\n\t\t\tWHERE timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\n\t\t\tORDER BY timestamp, stkcod DESC"; $stktake_rslt = db_exec($sql) or errDie("Unable to retrieve report."); $stock_take_ar = array(); while ($stktake_data = pg_fetch_array($stktake_rslt)) { $stock_take_ar[$stktake_data["timestamp"]][] = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stktake_data['stkcod']}</td>\n\t\t\t\t<td>{$stktake_data['stkdes']}</td>\n\t\t\t\t<td>{$stktake_data['qty']}</td>\n\t\t\t</tr>"; } $stock_take_out = ""; foreach ($stock_take_ar as $timestamp => $lv2) { $stock_take_out = "\n\t\t<h3>{$timestamp}</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Qty</th>\n\t\t\t</tr>"; foreach ($lv2 as $out) { $stock_take_out .= $out; } $stock_take_out .= "\n\t\t</table>"; } $OUTPUT = "\n\t<center>\n\t<h3>Stock Take Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t{$stock_take_out}\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "\n\tSELECT invnum, cash, cheque, credit, sdate, cusname\n\tFROM cubit.nons_invoices\n\tWHERE sdate BETWEEN '{$from_date}' AND '{$to_date}' AND hire_invnum!='0'"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices."); $total_cash = 0; $total_cheque = 0; $total_credit = 0; $inv_out = ""; while ($inv_data = pg_fetch_array($inv_rslt)) { $inv_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$inv_data['sdate']}</td>\n\t\t\t<td align='center'>{$inv_data['invnum']}</td>\n\t\t\t<td>{$inv_data['cusname']}</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cash"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["cheque"]) . "</td>\n\t\t\t<td align='right'>" . sprint($inv_data["credit"]) . "</td>\n\t\t</tr>"; $total_cash += $inv_data["cash"]; $total_cheque += $inv_data["cheque"]; $total_credit += $inv_data["credit"]; } if (empty($inv_out)) { $inv_out = "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='6'><li>No results found.</li></td>\n\t\t</tr>"; } $OUTPUT = "\n\t<center>\n\t<h3>Daily Hire Cashup Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Date</th>\n\t\t\t<th>Invoice No</th>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Cash</th>\n\t\t\t<th>Cheque</th>\n\t\t\t<th>Credit Card</th>\n\t\t</tr>\n\t\t{$inv_out}\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='3'><b>Total</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cash) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_cheque) . "</b></td>\n\t\t\t<td align='right'><b>" . sprint($total_credit) . "</b></td>\n\t</table>\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "\n\tSELECT ordno, cordno, total FROM cubit.dispatch_scans\n\t\tLEFT JOIN cubit.sorders ON dispatch_scans.sordid=sorders.sordid\n\tWHERE timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\n\t\tAND duplicate='0'"; $dispatch_rslt = db_exec($sql) or errDie("Unable to retrieve scans."); $report_out = ""; while ($dispatch_data = pg_fetch_array($dispatch_rslt)) { $report_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$dispatch_data['ordno']}</td>\n\t\t\t<td> </td>\n\t\t\t<td>{$dispatch_data['cordno']}</td>\n\t\t\t<td>{$dispatch_data['total']}</td>\n\t\t\t<td> </td>\n\t\t\t<td> </td>\n\t\t\t<td> </td>\n\t\t</tr>"; } if (empty($report_out)) { $report_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='8'><li>No results found</li></td>\n\t\t</tr>"; } $OUTPUT = "\n\t<h3>Dispatch Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Order No.</th>\n\t\t\t<th>Invoice No.</th>\n\t\t\t<th>Customer Order No.</th>\n\t\t\t<th>Amount</th>\n\t\t\t<th>Date Dispatch</th>\n\t\t\t<th>How Dispatched</th>\n\t\t\t<th>Other Dispatch Information</th>\n\t\t</tr>\n\t\t{$report_out}\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "\n\tSELECT id, stock.stkcod, stock.stkdes, qty, cost_per_unit, (qty*cost_per_unit) AS total,\n\t\textract('epoch' FROM timestamp) AS e_time\n\tFROM cubit.manu_hist_main\n\t\tLEFT JOIN cubit.stock ON manu_hist_main.stkid=stock.stkid\n\tWHERE timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\n\tORDER BY timestamp DESC"; $main_rslt = db_exec($sql) or errDie("Unable to retrieve main items."); $hist_out = ""; while ($main_data = pg_fetch_array($main_rslt)) { $hist_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td><b>" . date("d-m-Y", $main_data["e_time"]) . "</b></td>\n\t\t\t\t<td><b>({$main_data['stkcod']}) {$main_data['stkdes']}</b></td>\n\t\t\t\t<td align='center'><b>{$main_data['qty']}</b></td>\n\t\t\t\t<td align='right'><b>" . sprint($main_data["cost_per_unit"]) . "</b></td>\n\t\t\t\t<td align='right'><b>" . sprint($main_data["total"]) . "</b></td>\n\t\t\t</tr>"; $sql = "\n\t\tSELECT stkcod, stkdes, qty, cost_per_unit, (qty*cost_per_unit) AS total\n\t\tFROM cubit.manu_hist_sub\n\t\t\tLEFT JOIN cubit.stock ON manu_hist_sub.stkid=stock.stkid\n\t\tWHERE main_id='{$main_data['id']}'\n\t\tORDER BY timestamp ASC"; $sub_rslt = db_exec($sql) or errDie("Unable to retrieve sub items."); while ($sub_data = pg_fetch_array($sub_rslt)) { $hist_out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td> </td>\n\t\t\t\t\t<td>({$sub_data['stkcod']}) {$sub_data['stkdes']}</td>\n\t\t\t\t\t<td align='center'>{$sub_data['qty']}</td>\n\t\t\t\t\t<td align='right'>" . sprint($sub_data["cost_per_unit"]) . "</td>\n\t\t\t\t\t<td align='right'>" . sprint($sub_data["total"]) . "</td>\n\t\t\t\t</tr>"; } } if (empty($hist_out)) { $hist_out = "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='5'><li>No results found.</li></td>\n\t\t\t</tr>"; } $OUTPUT = "\n\t\t<center>\n\t\t<h3>Manufacturing Cost Report</h3>\n\t\t<form method='post' action='" . SELF . "'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th colspan='4'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td> <b>To</b> </td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t\t<td><input type='submit' value='Select' style='font-weight:bold' /></td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Date</th>\n\t\t\t\t<th>Stock</th>\n\t\t\t\t<th>Qty</th>\n\t\t\t\t<th>Cost per Unit</th>\n\t\t\t\t<th>Total</th>\n\t\t\t</tr>\n\t\t\t{$hist_out}\n\t\t</table>\n\t\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $OUTPUT = "<center>\r\n\t<h3>Equipment to be Returned</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Continue' style='text-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>"; // Retrieve equipment to be returned $sql = "SELECT *,\r\n\t\t\t\t(SELECT des FROM cubit.assets WHERE id=asset_id) AS des,\r\n\t\t\t\t(SELECT serial FROM cubit.assets WHERE id=asset_id) AS serial\r\n\t\t\tFROM hire.hire_invitems\r\n\t\t\tORDER BY des ASC"; $items_rslt = db_exec($sql) or errDie("Unable to retrieve items."); $items_out = ""; while ($items_data = pg_fetch_array($items_rslt)) { $sql = "SELECT * FROM hire.hire_invoices WHERE invid='{$items_data['invid']}'"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoice."); $inv_data = pg_fetch_array($inv_rslt); $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$inv_data['cusnum']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customer."); $cust_data = pg_fetch_array($cust_rslt); if (!hiredDate($items_data["id"])) { continue; } $items_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . hiredDate($items_data["id"]) . "</td>\r\n\t\t\t<td>" . returnDate($items_data["id"]) . "</td>\r\n\t\t\t<td>{$items_data['des']}</td>\r\n\t\t\t<td>" . getSerial($items_data["asset_id"]) . "</td>\r\n\t\t\t<td>{$items_data['qty']}</td>\r\n\t\t\t<td>{$cust_data['surname']} {$cust_data['cusname']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='hire-invoice-new.php?invid={$items_data['invid']}'>\r\n\t\t\t\t\tView Hire\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } $OUTPUT .= "<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hired</th>\r\n\t\t\t<th>To Be Returned</th>\r\n\t\t\t<th>Plant</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Qty</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Options</th>\r\n\t\t</tr>\r\n\t\t{$items_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT assets.id, des, description, service_description,\r\n\t\t\t\textract('epoch' FROM timestamp) AS e_time\r\n\t\t\tFROM hire.service_history\r\n\t\t\t\tLEFT JOIN cubit.assets ON service_history.asset_id=assets.id\r\n\t\t\tWHERE timestamp BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'"; $hist_rslt = db_exec($sql) or errDie("Unable to retrieve service history."); $hist_out = ""; while ($hist_data = pg_fetch_array($hist_rslt)) { $hist_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . date("d-m-Y G:i:s", $hist_data["e_time"]) . "</td>\r\n\t\t\t<td>{$hist_data['des']}</td>\r\n\t\t\t<td>" . getSerial($hist_data["id"]) . "</td>\r\n\t\t\t<td>{$hist_data['service_description']}</td>\r\n\t\t</tr>"; } if (empty($hist_out)) { $hist_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Service History Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' style='font-weight:bold' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Date/Time</th>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Service Description</th>\r\n\t\t</tr>\r\n\t\t{$hist_out}\r\n\t</table>"; return $OUTPUT; }
function slct() { db_conn(YR_DB); $sql = "SELECT * FROM info WHERE prdname !=''"; $prdRslt = db_exec($sql); if (pg_numrows($prdRslt) < 1) { return "<li class='err'>ERROR : There are no periods set for the current year</li>"; } $Prds = "<select name='prd' style='width: 100%'>"; while ($prd = pg_fetch_array($prdRslt)) { if ($prd['prddb'] == PRD_DB) { $sel = "selected"; } else { $sel = ""; } $Prds .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>"; } $Prds .= "</select>"; db_connect(); $sql = "SELECT * FROM customers WHERE div = '" . USER_DIV . "' ORDER BY surname ASC"; $cusRslt = db_exec($sql) or errDie("Could not retrieve Customers Information from the Database.", SELF); if (pg_numrows($cusRslt) < 1) { return "<li class='err'> There are no Customers in Cubit.</li>"; } $custs = "<select name='cusnum' style='width: 100%'>"; while ($cus = pg_fetch_array($cusRslt)) { $custs .= "<option value='{$cus['cusnum']}'>{$cus['cusname']} {$cus['surname']}</option>"; } $custs .= "</select>"; //layout $slct = "\n\t\t<h3>View Paid Invoices<h3>\n\t\t<table " . TMPL_tblDflts . " width='500'>\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='view'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>By Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2' nowrap>\n\t\t\t\t\t" . mkDateSelect("from", date("Y"), date("m"), "01") . "\n\t\t\t\t\t TO \n\t\t\t\t\t" . mkDateSelect("to") . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Select Customer</td>\n\t\t\t\t<td>{$custs}</td>\n\t\t\t\t<td><input type='submit' value='Search'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td colspan='2' align='center'>OR</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Input customer account number</td>\n\t\t\t\t<td><input type='text' name='accnum' size='10'></td>\n\t\t\t\t<td valign='bottom'><input type='submit' value='View'></td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>All Customers</td>\n\t\t\t\t<td><input type='submit' name='all' value='List All »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>\n\t\t<p>\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\n\t\t\t<tr>\n\t\t\t\t<th>Quick Links</th>\n\t\t\t</tr>\n\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t</table>"; return $slct; }
function slctacc($err = "") { extract($_POST); db_conn(PRD_DB); if (!isset($refnum)) { $refnum = getrefnum(); } // if (empty($jr_year)) { // explodeDate(false, $jr_year, $jr_month, $jr_day); // } if (empty($dtaccid)) { $dtaccid = false; } if (empty($ctaccid)) { $ctaccid = false; } /** REFNUM **/ //Select Account <input align='right' type='button' onClick=\"popupSized('acc-new2.php?update_parent=yes','accounts','700','400');\" value='Add Account'> if (!isset($yr_day)) { $trans_date_setting = getCSetting("USE_TRANSACTION_DATE"); if (isset($trans_date_setting) and $trans_date_setting == "yes") { $trans_date_value = getCSetting("TRANSACTION_DATE"); $date_arr = explode("-", $trans_date_value); $jr_year = $date_arr[0]; $jr_month = $date_arr[1]; $jr_day = $date_arr[2]; } else { $jr_year = date("Y"); $jr_month = date("m"); $jr_day = date("d"); } } $view = "\n\t\t<center>\n\t\t<h3> Journal transaction </h3>\n\t\t{$err}\n\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t<input type='hidden' name='key' value='details' />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Field</th>\n\t\t\t\t<th>Value</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Date</td>\n\t\t\t\t<td>" . mkDateSelect("jr", $jr_year, $jr_month, $jr_day) . "</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Reference Number</td>\n\t\t\t\t<td><input type='text' size='10' name='refnum' value='" . $refnum++ . "'></td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><h4>Debit</h4></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Select Account <input align='right' type='button' onClick=\"window.open('acc-new2.php?update_parent=yes','accounts','width=700, height=400');\" value='New Account'></th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td valign='center'>" . mkAccSelect("dtaccid", $dtaccid) . "</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><h4>Credit</h4></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Select Account <input align='right' type='button' onClick=\"window.open('acc-new2.php?update_parent=yes','accounts','width=700, height=400');\" value='New Account'></th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolorc(0) . "'>\n\t\t\t\t\t\t\t<td valign='center'>" . mkAccSelect("ctaccid", $ctaccid) . "</td>\n\t\t\t\t\t\t\t<td><input name='details' type='submit' value='Enter Details >'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<br />\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><h4>Debit</h4></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Account number</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolorc(0) . "'>\n\t\t\t\t\t\t\t<td valign='center'><input type='text' name='dtaccnum' size='20'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t\t<td align='center'>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td><h4>Credit</h4></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Account number</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr bgcolor='" . bgcolorc(0) . "'>\n\t\t\t\t\t\t\t<td valign='center'><input type='text' name='ctaccnum' size='20'></td>\n\t\t\t\t\t\t\t<td><input type='submit' value='Enter Details >'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<br />\n\t\t</form>" . mkQuickLinks(ql("../reporting/index-reports.php", "Financials"), ql("../core/acc-new2.php", "Add New Account"), ql("trans-new.php", "Journal Transactions")); return $view; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; if (isset($id)) { $where = "AND doc_id='{$id}'"; } else { $where = ""; } $sql = "SELECT *,extract('epoch' FROM timestamp) AS e_time FROM cubit.document_movement\n\tWHERE (timestamp BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59') {$where} ORDER BY timestamp DESC"; $dm_rslt = db_exec($sql) or errDie("Unable to retrieve document movement"); $dm_out = ""; while ($dm_data = pg_fetch_array($dm_rslt)) { $bgcolor = bgcolorg(); $dm_out .= "<tr class='" . bg_class() . "'>\n\t\t\t<td>" . date("d-m-Y G:i:s", $dm_data["e_time"]) . "</td>\n\t\t\t<td>{$dm_data['doc_id']}</td>\n\t\t\t<td>{$dm_data['project']}</td>\n\t\t\t<td>{$dm_data['area']}</td>\n\t\t\t<td>{$dm_data['discipline']}</td>\n\t\t\t<td>{$dm_data['doc_type']}</td>\n\t\t\t<td>{$dm_data['revision']}</td>\n\t\t\t<td>{$dm_data['drawing_num']}</td>\n\t\t\t<td>{$dm_data['sheet_num']}</td>\n\t\t\t<td>{$dm_data['title']}</td>\n\t\t\t<td>{$dm_data['location']}</td>\n\t\t\t<td>{$dm_data['contract']}</td>\n\t\t\t<td>{$dm_data['contractor']}</td>\n\t\t\t<td>{$dm_data['code']}</td>\n\t\t\t<td>{$dm_data['issue_for']}</td>\n\t\t\t<td>{$dm_data['qs']}</td>\n\t\t\t<td>{$dm_data['status']}</td>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='20'>{$dm_data['movement_description']}</td>\n\t\t</tr>"; } if (empty($dm_out)) { $dm_out = "<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='20'><li>No results found.</li></td>\n\t\t</tr>"; } $OUTPUT = "<center>\n\t<h3>Document Movement Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td><b>To</b></td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t<td><input type='submit' value='Select' /></td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Time</th>\n\t\t\t<th>Record Number</th>\n\t\t\t<th>Project</th>\n\t\t\t<th>Area</th>\n\t\t\t<th>Discipline</th>\n\t\t\t<th>Document Type</th>\n\t\t\t<th>Revision</th>\n\t\t\t<th>Drawing Number</th>\n\t\t\t<th>Sheet Number</th>\n\t\t\t<th>Title</th>\n\t\t\t<th>Location</th>\n\t\t\t<th>Contract</th>\n\t\t\t<th>Contractor</th>\n\t\t\t<th>Code</th>\n\t\t\t<th>Issue For</th>\n\t\t\t<th>QS</th>\n\t\t\t<th>Status</th>\n\t\t</tr>\n\t\t{$dm_out}\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT assets.id, assets.des AS asset_des, asset_svdates.svdate,\r\n\t\t\t\tasset_svdates.des AS sv_des\r\n\t\t\tFROM cubit.asset_svdates\r\n\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\tON asset_svdates.asset_id=assets.id\r\n\t\t\tWHERE asset_svdates.svdate BETWEEN '{$from_date}' AND '{$to_date}'"; $sv_rslt = db_exec($sql) or errDie("Unable to retrieve asset services."); $service_out = ""; while ($sv_data = pg_fetch_array($sv_rslt)) { if (empty($sv_data["id"])) { continue; } $service_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$sv_data['asset_des']}</td>\r\n\t\t\t<td>" . getSerial($sv_data["id"]) . "</td>\r\n\t\t\t<td>{$sv_data['sv_des']}</td>\r\n\t\t\t<td>{$sv_data['svdate']}</td>\r\n\t\t</tr>"; } if (empty($service_out)) { $service_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Service Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Service Description</th>\r\n\t\t\t<th>Service Date</th>\r\n\t\t</tr>\r\n\t\t{$service_out}\r\n\t</table>"; return $OUTPUT; }
function slct() { extract($_GET); db_connect(); $cust_arr = array(); $ncust_arr = array(); #get list of all customers $get_cust = "SELECT surname FROM customers ORDER by surname"; $run_cust = db_exec($get_cust) or errDie("Unable to get customers information."); if (pg_numrows($run_cust) > 0) { while ($temp = pg_fetch_array($run_cust)) { $cust_arr[] = $temp['surname']; } } #now get the non stock invoices customers $get_ncust = "SELECT distinct(cusname) FROM nons_invoices ORDER BY cusname"; $run_ncust = db_exec($get_ncust) or errDie("Unable to get customers information."); if (pg_numrows($run_ncust) > 0) { while ($temp = pg_fetch_array($run_ncust)) { $ncust_arr[] = $temp['cusname']; } } $allcust_arr = array_merge($cust_arr, $ncust_arr); $allcust_arr = array_unique($allcust_arr); ksort($allcust_arr); #make customer drop ... $cust_drop = "<select name='customer'>"; $cust_drop .= "<option value='0'>All</option>"; foreach ($ncust_arr as $each) { $cust_drop .= "<option value='{$each}'>{$each}</option>"; } $cust_drop .= "</select>"; $slct = "\r\n\t\t<h3>View Incomplete Non-Stock Invoices</h3>\r\n\t\t<table " . TMPL_tblDflts . " width='580'>\r\n\t\t<form action='" . SELF . "' method='POST' name='form'>\r\n\t\t\t<input type='hidden' name='key' value='view'>\r\n\t\t\t" . (isset($mode) ? "<input type='hidden' name='mode' value='{$mode}'>" : "") . "\r\n\t\t\t<tr>\r\n\t\t\t\t<th colspan='2'>By Date Range</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center' nowrap>\r\n\t\t\t\t\t" . mkDateSelect("from", date("Y"), date("m"), "01") . "\r\n\t\t\t\t\t TO \r\n\t\t\t\t\t" . mkDateSelect("to") . "\r\n\t\t\t</td>\r\n\t\t\t\t<td valign='bottom'><input type='submit' value='Search'></td>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Select Customer</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td align='center'>{$cust_drop}</td>\r\n\t\t\t</tr>\r\n\t\t</form>\r\n\t\t</table>\r\n\t\t<p>\r\n\t\t<table border='0' cellpadding='2' cellspacing='1'>\r\n\t\t\t<tr>\r\n\t\t\t\t<th>Quick Links</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='nons-invoice-new.php'>New Non Stock Invoice</a></td>\r\n\t\t\t</tr>\r\n\t\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t\t<td><a href='main.php'>Main Menu</a></td>\r\n\t\t\t</tr>\r\n\t\t</table>"; return $slct; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT invid, invnum, customers.surname, hire_invid,\r\n\t\t\t\textract('epoch' FROM reprint_invoices.odate) AS e_date\r\n\t\t\t\tFROM hire.reprint_invoices\r\n\t\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\t\tON reprint_invoices.cusnum=customers.cusnum\r\n\t\t\tWHERE reprint_invoices.odate BETWEEN '{$from_date}' AND '{$to_date}'\r\n\t\t\tORDER BY invnum DESC"; $reprint_rslt = db_exec($sql) or errDie("Unable to retrieve reprints."); $reprint_out = ""; while ($reprint_data = pg_fetch_array($reprint_rslt)) { if (!$reprint_data["invnum"]) { continue; } $reprint_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H{$reprint_data['invnum']}" . rrev($reprint_data["invid"]) . "</td>\r\n\t\t\t<td>{$reprint_data['surname']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $reprint_data["e_date"]) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='javascript:printer" . "(\"hire/hire_note_reprint.php?invid={$reprint_data['invid']}\")'>\r\n\t\t\t\t\tReprint\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($reprint_out)) { $reprint_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No results found.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>View Hire Note Reprints</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Reprint</th>\r\n\t\t</tr>\r\n\t\t{$reprint_out}\r\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = dateFmt($from_year, $from_month, $from_day); $to_date = dateFmt($to_year, $to_month, $to_day); // Retrieve hires $sql = "\r\n\tSELECT *,\r\n\t\t(SELECT username FROM cubit.users WHERE userid=user_id) AS username,\r\n\t\t(SELECT surname FROM cubit.customers WHERE cusnum=cust_id) AS surname,\r\n\t\t(SELECT cusname FROM cubit.customers WHERE cusnum=cust_id) AS cusname,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM from_time)) AS e_from,\r\n\t\t(SELECT EXTRACT('EPOCH' FROM to_time)) AS e_to\r\n\tFROM hire.hires\r\n\tWHERE from_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\tto_time BETWEEN '{$from_date} 00:00:00' AND '{$to_date} 23:59:59'\r\n\tORDER BY e_from ASC"; $hire_rslt = db_exec($sql) or errDie("Unable to retrieve hires."); $hire_out = ""; while ($hire_data = pg_fetch_array($hire_rslt)) { $time = date("d-m-Y G:i:s", $hire_data["e_from"]); $hire_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$time}</td>\r\n\t\t\t<td>{$hire_data['inv_id']}</td>\r\n\t\t\t<td>{$hire_data['username']}</td>\r\n\t\t\t<td>\r\n\t\t\t\t<a href='../cust-det.php?cusnum={$hire_data['cust_id']}'>\r\n\t\t\t\t\t{$hire_data['cusname']} {$hire_data['surname']}\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t</tr>"; } if (empty($hire_out)) { $hire_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } if (empty($invoice_out)) { $invoice_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4'><li>No items found for this date range</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Daily Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>HIRES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$hire_out}\r\n\t\t<tr>\r\n\t\t\t<th colspan='4' style='font-size: 16px'>INVOICES</th>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Time</th>\r\n\t\t\t<th>Invoice No</th>\r\n\t\t\t<th>Sales Person</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t</tr>\r\n\t\t{$invoice_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["section_id"] = 0; $fields["id"] = 0; extract($fields, EXTR_SKIP); // Create the sections dropdown $sql = "SELECT * FROM cubit.today_sections ORDER BY name ASC"; $section_rslt = db_exec($sql) or errDie("Unable to retrieve section."); $section_sel = "\n\t\t<select name='section_id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t<option value='0'>[None]</option>"; while ($section_data = pg_fetch_array($section_rslt)) { if ($section_id == $section_data["id"]) { $sel = "selected"; } else { $sel = ""; } $section_sel .= "<option value='{$section_data['id']}' {$sel}>{$section_data['name']}</option>"; } // Retrieve the section if ($section_id) { $sql = "SELECT * FROM cubit.today_sections WHERE id='{$section_id}'"; $section_rslt = db_exec($sql) or errDie("Unable to retrieve section."); $section_data = pg_fetch_array($section_rslt); $section_name = $section_data["name"]; $sql = "SELECT * FROM {$section_data['table_name']} ORDER BY {$section_data['title_column']} ASC"; $id_rslt = db_exec($sql) or errDie("Unable to retieve {$section_data['name']}"); $id_sel = "\n\t\t\t<select name='id' onchange='javascript:document.form.submit()' style='width: 100%'>\n\t\t\t\t<option value='0'>[None]</option>"; while ($id_data = pg_fetch_array($id_rslt)) { if ($id == $id_data[$section_data["id_column"]]) { $sel = "selected"; } else { $sel = ""; } $id_sel .= "\n\t\t\t\t<option value='" . $id_data[$section_data["id_column"]] . "' {$sel}>\n\t\t\t\t\t" . $id_data[$section_data["title_column"]] . "\n\t\t\t\t</option>"; } $id_sel .= "</select>"; } else { $section_name = ""; $id_sel = "Please Select a Section"; } $OUTPUT = "\n\t\t<h3>{$section_name} Brought Forward Dates</h3>\n\t\t<form method='POST' action='" . SELF . "' name='form' />\n\t\t<table cellpadding='2' cellspacing='0' class='shtable'>\n\t\t\t<tr>\n\t\t\t\t<th>Section</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$section_sel}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$id_sel}</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<p></p>"; if ($section_id && $id) { // if section id already exists section_data should be available // retrieve the title $sql = "\n\t\t\tSELECT {$section_data['title_column']} \n\t\t\tFROM {$section_data['table_name']} \n\t\t\tWHERE {$section_data['id_column']}='{$id}'"; $title_rslt = db_exec($sql) or errDie("Unable to retrieve title."); $title = pg_fetch_result($title_rslt, 0); $sql = "\n\t\t\tSELECT *,extract('epoch' FROM date) as e_date \n\t\t\tFROM cubit.today \n\t\t\tWHERE section_id='{$section_id}' AND title='{$title}' AND user_id='" . USER_ID . "' \n\t\t\tORDER BY id DESC"; $today_rslt = db_exec($sql) or errDie("Unable to retrieve today entries."); $today_out = ""; while ($today_data = pg_fetch_array($today_rslt)) { $date = date("d-m-Y", $today_data["e_date"]); $today_out .= "\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>{$date}</td>\n\t\t\t\t\t<td>{$today_data['info']}</td>\n\t\t\t\t\t<td align='center'>\n\t\t\t\t\t\t<input type='checkbox' name='rem' value='{$today_data['id']}'\n\t\t\t\t\t\tonchange='javascript:document.remfrm.submit()' />\n\t\t\t\t\t</td>\n\t\t\t\t</tr>"; } $OUTPUT .= "\n\t\t\t<table cellpadding='5' cellspacing='0' class='shtable'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Date</th>\n\t\t\t\t\t<th>Info</th>\n\t\t\t\t\t<th>Options</th>\n\t\t\t\t</tr>\n\t\t\t<form method='POST' action='" . SELF . "'>\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td nowrap>" . mkDateSelect("date") . "</td>\n\t\t\t\t\t<td><input type='text' name='info' style='width: 100%' /></td>\n\t\t\t\t\t<td><input type='submit' name='key' value='Add' style='width:100%' /></td>\n\t\t\t\t</tr>\n\t\t\t</form>\n\t\t\t<form method='post' action='" . SELF . "' name='remfrm' />\n\t\t\t\t<input type='hidden' name='section_id' value='{$section_id}' />\n\t\t\t\t<input type='hidden' name='id' value='{$id}' />\n\t\t\t\t<input type='hidden' name='key' value='remove' />\n\t\t\t\t{$today_out}\n\t\t\t</form>\n\t\t\t</table>"; } $OUTPUT .= "\n\t\t<p></p>\n\t\t<a href='today.php' style='font-size: 12pt; font-weight: bold;'>Today Action Display</a><br><br>" . mkQuickLinks(ql("../crmsystem/leads_list.php", "Return To View Leads")); return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT stkid, stkcod, stkdes, units, minlvl FROM cubit.stock"; $stock_rslt = db_exec($sql) or errdie("Unable to retrieve stock."); $stock_out = ""; while ($stock_data = pg_fetch_array($stock_rslt)) { // Gather all the data we need to perform the calculations $qty_units = $stock_data["units"]; $qty_min = $stock_data["minlvl"]; $qty_sales = averageSalesQty($stock_data["stkid"], $from_date, $to_date, "YEARLY"); $qty_ordered = qty_ordered($stock_data["stkid"], $from_date, $to_date); $total_qty = $qty_units + $qty_ordered - $qty_sales; if ($total_qty <= $qty_min) { $qty_suggest = (int) ($qty_min - $total_qty); } // Nothing interesting to see here... if (!isset($qty_suggest) || !$qty_suggest) { continue; } $stock_out .= "\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>{$stock_data['stkcod']}</td>\n\t\t\t\t<td>{$stock_data['stkdes']}</td>\n\t\t\t\t<td align='center'><b>{$qty_suggest}</b></td>\n\t\t\t\t<td>" . orderDate($stock_data["stkid"], $from_date, $to_date) . "</td>\n\t\t\t</tr>"; } $OUTPUT = "\n\t\t<center>\n\t\t<h3>Recommended Order Date and Order Quantity Report</h3>\n\t\t<form method='post' action='" . SELF . "'>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr><th colspan='4'>Date Range</th></tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td> <b> To </b> </td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t\t<td>\n\t\t\t\t\t<input type='submit' value='Apply' style='font-weight: bold' />\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</form>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr>\n\t\t\t\t<th>Stock Code</th>\n\t\t\t\t<th>Stock Description</th>\n\t\t\t\t<th>Suggested Order Qty</th>\n\t\t\t\t<th>Suggested Order Date</th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>"; return $OUTPUT; }
function get_range($err = "") { $blocked_range_from = getCSetting("BLOCKED_FROM"); $blocked_range_to = getCSetting("BLOCKED_TO"); if (!isset($blocked_range_from) or strlen($blocked_range_from) < 1) { $blocked_range_from = date("Y-m-d"); } if (!isset($blocked_range_to) or strlen($blocked_range_to) < 1) { $blocked_range_to = date("Y-m-d"); } $from_arr = explode("-", $blocked_range_from); $to_arr = explode("-", $blocked_range_to); $from_year = $from_arr[0]; $from_month = $from_arr[1]; $from_day = $from_arr[2]; $to_year = $to_arr[0]; $to_month = $to_arr[1]; $to_day = $to_arr[2]; // $from_year = substr ($blocked_range_from,0,4); // $from_month = substr ($blocked_range_from,5,2); // $from_day = substr ($blocked_range_from,8,2); // // $to_year = substr ($blocked_range_to,0,4); // $to_month = substr ($blocked_range_to,5,2); // $to_day = substr ($blocked_range_to,8,2); $display = "\n\t\t<h4>Set Date Range to Block Transactions In</h4>\n\t\t{$err}\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Date Range</th>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<th>From Date</th>\n\t\t\t\t<th>To Date</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t\t</tr>\n\t\t\t" . TBL_BR . "\n\t\t\t<tr>\n\t\t\t\t<td align='right' colspan='2'><input type='submit' value='Save Setting'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>"; return $display; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; $sql = "SELECT assets_hired.invnum, surname, des, assets_hired.invid,\r\n\t\t\t\textract('epoch' FROM hired_time) AS e_hired,\r\n\t\t\t\textract('epoch' FROM return_time) AS e_return\r\n\t\t\tFROM hire.assets_hired\r\n\t\t\t\tLEFT JOIN hire.notes_reprint\r\n\t\t\t\t\tON assets_hired.invid=notes_reprint.invid\r\n\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\tON assets_hired.cust_id=customers.cusnum\r\n\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\tON assets_hired.asset_id=assets.id\r\n\t\t\tWHERE hired_time BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59' OR\r\n\t\t\t\treturn_time BETWEEN '{$from_date} 0:00:00' AND '{$to_date} 23:59:59'\r\n\t\t\tORDER BY invnum DESC"; $history_rslt = db_exec($sql) or errDie("Unable to retrieve history."); $history_out = ""; while ($history_data = pg_fetch_array($history_rslt)) { if ($history_data["e_return"]) { $return = date("d-m-Y", $history_data["e_return"]); } else { $return = "Still on Hire"; } $history_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>H" . getHirenum($history_data["invid"], 1) . "</td>\r\n\t\t\t<td>{$history_data['surname']}</td>\r\n\t\t\t<td>{$history_data['des']}</td>\r\n\t\t\t<td>" . date("d-m-Y", $history_data["e_hired"]) . "</td>\r\n\t\t\t<td>{$return}</td>\r\n\t\t</tr>"; } if (empty($history_out)) { $history_out = "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'><li>No results found</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Hire History Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr><th colspan='4'>Date Range</th></tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td>\r\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Company / Name</th>\r\n\t\t\t<th>Product</th>\r\n\t\t\t<th>Date Hired</th>\r\n\t\t\t<th>Date Returned</th>\r\n\t\t</tr>\r\n\t\t{$history_out}\r\n\t</table>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = "01"; $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); extract($fields, EXTR_SKIP); $from_date = "{$from_year}-{$from_month}-{$from_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; // Retrieve invoices $sql = "SELECT * FROM hire.hire_invoices WHERE done='y'\r\n\t\t\t\tAND odate BETWEEN '{$from_date}' AND '{$to_date}'"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices."); $hires_out = ""; while ($inv_data = pg_fetch_array($inv_rslt)) { // Retrieve customer $sql = "SELECT * FROM cubit.customers WHERE cusnum='{$inv_data['cusnum']}'"; $cust_rslt = db_exec($sql) or errDie("Unable to retrieve customers."); $cust_data = pg_fetch_array($cust_rslt); $hires_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$inv_data['odate']}</td>\r\n\t\t\t<td align='center'>\r\n\t\t\t\t<a href='hire-invoice-new.php?invid={$inv_data['invid']}'>\r\n\t\t\t\t\tH" . getHirenum($inv["invid"], 1) . "\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>{$cust_data['surname']}</td>\r\n\t\t\t<td>" . CUR . "{$inv_data['total']}</td>\r\n\t\t\t<!--<td><a href='hires_return.php?invid={$inv_data['invid']}'>Return</a></td>-->\r\n\t\t\t<!--<td><a href='hires_swap.php?invid={$inv_data['invid']}'>Swap</a></td>-->\r\n\t\t</tr>"; } if (empty($hires_out)) { $hires_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'>No hire notes found for this date range.</td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Hire Report</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' style='font-weight: bold' /></td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<td colspan='5'>{$msg}</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th>Date</th>\r\n\t\t\t<th>Hire No</td>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Total</th>\r\n\t\t\t<!--<th colspan='2'>Options</th>-->\r\n\t\t</tr>\r\n\t\t{$hires_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function slctEmployee($err = "") { db_conn('cubit'); #check what we have permission to $get_perm = "SELECT payroll_groups FROM users WHERE username = '******'USER_NAME']}' LIMIT 1"; $run_perm = db_exec($get_perm) or errDie("Unable to get payroll groups permission information."); if (pg_numrows($run_perm) > 0) { $parr = pg_fetch_array($run_perm); if (strlen($parr['payroll_groups']) > 0) { $pay_grps = explode(",", $parr['payroll_groups']); if (is_array($pay_grps)) { $egsearch = " AND (emp_group = '" . implode("' OR emp_group = '", $pay_grps) . "')"; } } else { $egsearch = "AND false"; } } $Sl = "SELECT empnum,enum, sname, fnames FROM employees WHERE div = '" . USER_DIV . "' ORDER BY sname,fnames"; $Ry = db_exec($Sl) or errDie("Unable to select employees from database."); if (pg_numrows($Ry) < 1) { return "<li class='err'>No Employees Found In Cubit.</li>"; } $Sl = "SELECT empnum,enum, sname, fnames FROM employees WHERE div = '" . USER_DIV . "' {$egsearch} ORDER BY sname,fnames"; $Ry = db_exec($Sl) or errDie("Unable to select employees from database."); if (pg_numrows($Ry) < 1) { return "<li class='err'>You Have Insufficient Permissions To Access The Cubit Payroll. You May Add The Permission <a href='../admin-usredit.php?username={$_SESSION['USER_NAME']}'>Here</a></li>"; } $employees = "<select size='1' name='empnum'>"; while ($myEmp = pg_fetch_array($Ry)) { $employees .= "<option value='{$myEmp['empnum']}'>{$myEmp['sname']}, {$myEmp['fnames']} ({$myEmp['enum']})</option>"; } $employees .= "</select>"; $slctEmployee = "\n\t\t<h3>Select employee to reverse</h3>\n\t\t{$err}\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='prd'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Employee</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Employee</td>\n\t\t\t\t<td align='center'>{$employees}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Select month</td>\n\t\t\t\t<td align=center>" . empMonList("MON", DATE_MONTH) . "</td>\n\t\t\t\t<td class='err'>This is the period for which you are processing the salary.</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td nowrap>Processing Date</td>\n\t\t\t\t<td nowrap>" . mkDateSelect("date") . "</td>\n\t\t\t\t<td class='err'>This is the date Cubit will use to enter transactions into the ledgers.</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='Process »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table>"; return $slctEmployee; }
function add() { # Suppliers Drop down selections db_connect(); $cust = "<select name='cusid'>"; $sql = "SELECT cusnum,cusname,surname FROM customers WHERE div = '" . USER_DIV . "' ORDER BY surname,cusname"; $cusRslt = db_exec($sql); $numrows = pg_numrows($cusRslt); if (empty($numrows)) { return "<li class='err'> There are no customers in Cubit.</li>"; } while ($cus = pg_fetch_array($cusRslt)) { $cust .= "<option value='{$cus['cusnum']}'>{$cus['cusname']} {$cus['surname']}</option>"; } $cust .= "</select>"; // layout $add = "\n\t\t\t\t\t<h3>New Bank Payment</h3>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST' name='form'>\n\t\t\t\t\t\t<input type='hidden' name='key' value='confirm'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t\t\t<th>Value</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Bank Account</td>\n\t\t\t\t\t\t\t<td valign='center'>\n\t\t\t\t\t\t\t\t<select name='bankid'>"; db_connect(); $sql = "SELECT * FROM bankacct WHERE div = '" . USER_DIV . "'"; $banks = db_exec($sql); $numrows = pg_numrows($banks); if (empty($numrows)) { return "\n\t\t\t\t\t\t\t<li class='err'> There are no accounts held at the selected Bank.</li>\n\t\t\t\t\t\t\t<p><input type='button' onClick='JavaScript:history.back();' value='« Correct Selection'>"; } while ($acc = pg_fetch_array($banks)) { $add .= "<option value={$acc['bankid']}>{$acc['accname']} - {$acc['bankname']}</option>"; } $add .= "\n\t\t\t\t\t\t\t</select>\n\t\t\t \t</td>\n\t\t\t </tr>\n\t\t\t <tr class='" . bg_class() . "'>\n\t\t\t \t<td>Date</td>\n\t\t\t \t<td>" . mkDateSelect("date") . "</td>\n\t\t\t </tr>\n\t\t\t <tr class='" . bg_class() . "'>\n\t\t\t \t<td>Customer paid to</td>\n\t\t\t \t<td valign='center'>{$cust}</td>\n\t\t\t </tr>\n\t\t\t <tr class='" . bg_class() . "'>\n\t\t\t \t<td>Description</td>\n\t\t\t \t<td valign='center'><textarea col='20' rows='5' name='descript'></textarea></td>\n\t\t\t </tr>\n\t\t\t <tr class='" . bg_class() . "'>\n\t\t\t \t<td>Cheque Number</td>\n\t\t\t \t<td valign='center'><input size='20' name='cheqnum'></td>\n\t\t\t </tr>\n\t\t\t <tr class='" . bg_class() . "'>\n\t\t\t \t<td>Amount</td>\n\t\t\t \t<td valign='center'>" . CUR . " <input type='text' size='18' name='amount'></td>\n\t\t\t </tr>\n\t\t\t\t\t" . TBL_BR . "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t<td valign='center'><input type='submit' value='Add »'></td>\n\t\t\t\t\t</tr>\n\t\t </table>"; # main table (layout with menu) $OUTPUT = "\n\t\t\t\t\t<center>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='65%' align='left'>{$add}</td>\n\t\t\t\t\t\t\t<td valign='top' align='center'>\n\t\t\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='65%'>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>"; return $OUTPUT; }
function view() { extract($_REQUEST); $fields = array(); $fields["frm_year"] = date("Y"); $fields["frm_month"] = date("m"); $fields["frm_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); $fields["search"] = ""; extract($fields, EXTR_SKIP); $sql = "\n\tSELECT invid, invnum, odate, surname, cordno, ordno, salespn\n\tFROM cubit.invoices\n\tWHERE done='n'\n\tORDER BY invnum DESC"; $inv_rslt = db_exec($sql) or errDie("Unable to retrieve invoices."); $inv_out = ""; while ($inv_data = pg_fetch_array($inv_rslt)) { $sql = "\n\t\tSELECT count(id) FROM cubit.inv_items\n\t\tWHERE invid='{$inv_data['invid']}'"; $count_rslt = db_exec($sql) or errDie("Unable to retrieve items."); $count = pg_fetch_result($count_rslt, 0); if ($count == 0) { continue; } $inv_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$inv_data['odate']}</td>\n\t\t\t<td>{$inv_data['surname']}</td>\n\t\t\t<td>{$inv_data['cordno']}</td>\n\t\t\t<td>{$inv_data['ordno']}</td>\n\t\t\t<td>{$inv_data['salespn']}</td>\n\t\t\t<td>\n\t\t\t\t<a href='" . SELF . "?key=edit&invid={$inv_data['invid']}'>\n\t\t\t\t\tSelect\n\t\t\t\t</a>\n\t\t\t</td>\n\t\t</tr>"; } $OUTPUT = "\n\t<center>\n\t<h3>Edit Invoice Prices</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<input type='hidden' name='key' value='view' />\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='2'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>" . mkDateSelect("frm", $frm_year, $frm_month, $frm_day) . "</td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th colspan='2'>Search</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>\n\t\t\t\t<input type='text' name='search' value='{$search}'\n\t\t\t\tstyle='width: 100%' />\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='2' align='center'>\n\t\t\t\t<input type='submit' value='Search' />\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t</form>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Date</th>\n\t\t\t<th>Customer</th>\n\t\t\t<th>Customer Order No.</th>\n\t\t\t<th>Order No</th>\n\t\t\t<th>Sales Person</th>\n\t\t\t<th> </th>\n\t\t</tr>\n\t\t{$inv_out}\n\t</table>\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["frm_year"] = date("Y") - 1; $fields["frm_month"] = date("m"); $fields["frm_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); $fields["group_id"] = 0; $fields["search"] = ""; extract($fields, EXTR_SKIP); $frm_date = "{$frm_year}-{$frm_month}-{$frm_day}"; $to_date = "{$to_year}-{$to_month}-{$to_day}"; // Create the groups dropdown $sql = "SELECT * FROM cubit.assetgrp"; $group_rslt = db_exec($sql) or errDie("Unable to retrieve asset group."); $group_sel = "<select name='group_id' style='width: 100%'>"; $group_sel .= "<option value='0'>All</option>"; while ($group_data = pg_fetch_array($group_rslt)) { if ($group_data["grpid"] == $group_id) { $sel = "selected"; } else { $sel = ""; } $group_sel .= "\r\n\t\t<option value='{$group_data['grpid']}' {$sel}>\r\n\t\t\t{$group_data['grpname']}\r\n\t\t</option>"; } // Retrieve the service history ------------------------------------------- $sql = "\r\n\tSELECT * FROM cubit.asset_svdates\r\n\tWHERE (svdate BETWEEN '{$frm_date}' AND '{$to_date}') ORDER BY svdate DESC"; $service_rslt = db_exec($sql) or errDie("Unable to retrieve service dates."); $service_out = ""; while ($service_data = pg_fetch_array($service_rslt)) { // Should we search by groups if ($group_id) { $group_sql = "AND grpid='{$group_id}'"; } else { $group_sql = ""; } // Retrieve the asset information $sql = "\r\n\t\tSELECT * FROM cubit.assets\r\n\t\tWHERE id='{$service_data['asset_id']}' {$group_sql} AND (\r\n\t\t\tdes ILIKE '{$search}%' OR serial ILIKE '{$search}%' OR\r\n\t\t\tserial2 ILIKE '{$search}%')"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve asset data."); if (!pg_num_rows($asset_rslt)) { continue; } $asset_data = pg_fetch_array($asset_rslt); // Retrieve the asset group $sql = "SELECT * FROM cubit.assetgrp WHERE grpid='{$asset_data['grpid']}'"; $group_rslt = db_exec($sql) or errDie("Unable to retrieve asset group."); $group_data = pg_fetch_array($group_rslt); $service_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$service_data['svdate']}</td>\r\n\t\t\t<td>{$group_data['grpname']}</td>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td>{$asset_data['serial']}</td>\r\n\t\t\t<td>{$asset_data['serial2']}</td>\r\n\t\t</tr>"; } if (empty($service_out)) { $service_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'>No results found.</td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Assets Service History</h3>\r\n\t<form method='post' action='" . SELF . "'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td><b> From </b></td>\r\n\t\t\t<td>" . mkDateSelect("frm", $frm_year, $frm_month, $frm_day) . "</td>\r\n\t\t\t<td><b> To </b></td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t</tr>\r\n\t\t<tr>\r\n\t\t\t<th colspan='2'>Search</th>\r\n\t\t\t<th colspan='2'>Group</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='2'>\r\n\t\t\t\t<input type='text' name='search' value='{$search}'\r\n\t\t\t\tstyle='width:100%' />\r\n\t\t\t</td>\r\n\t\t\t<td colspan='2'>{$group_sel}</td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='4' align='center'>\r\n\t\t\t\t<input type='submit' value='Search »' />\r\n\t\t\t</td>\r\n\t\t</tr>\r\n\t</table>\r\n\t</form>\r\n\t<p></p>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Service Date</th>\r\n\t\t\t<th>Group</th>\r\n\t\t\t<th>Description</th>\r\n\t\t\t<th>Serial No</th>\r\n\t\t\t<th>2nd Serial No</th>\r\n\t\t</tr>\r\n\t\t{$service_out}\r\n\t</table>\r\n\t</center>"; return $OUTPUT; }
function display() { extract($_REQUEST); $fields = array(); $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("d"); $fields["group_id"] = 0; $fields["type_id"] = 0; extract($fields, EXTR_SKIP); $sql = "SELECT grpid, grpname FROM cubit.assetgrp ORDER BY grpname ASC"; $group_rslt = db_exec($sql) or errDie("Unable to retrieve groups."); $group_sel = "\n\t<select name='group_id' style='width: 100%'>\n\t\t<option value='0'>[All]</option>"; while ($group_data = pg_fetch_array($group_rslt)) { $sel = $group_id == $group_data["grpid"] ? "selected='t'" : ""; $group_sel .= "\n\t\t<option value='{$group_data['grpid']}'>\n\t\t\t{$group_data['grpname']}\n\t\t</option>"; } $group_sel .= "</select>"; $sql = "SELECT id, name FROM cubit.asset_types ORDER BY name ASC"; $type_rslt = db_exec($sql) or errDie("Unable to retrieve asset types."); $type_sel = "\n\t<select name='type_id' style='width: 100%'>\n\t\t<option value='0'>[All]</option>"; while ($type_data = pg_fetch_array($type_rslt)) { $sel = $type_id == $type_data["id"] ? "selected='t'" : ""; $type_sel .= "\n\t\t<option value='{$type_data['id']}'>\n\t\t\t{$type_data['name']}\n\t\t</option>"; } $type_sel .= "</select>"; $OUTPUT = "\n\t<center>\n\t<h3>Asset Sale Report</h3>\n\t<form method='post' action='" . SELF . "'>\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th colspan='4'>Date Range</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td><b>From</b> </td>\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\n\t\t\t<td> <b>To</b> </td>\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th colspan='2'>Group</th>\n\t\t\t<th colspan='2'>Type</th>\n\t\t</tr>\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='2'>{$group_sel}</td>\n\t\t\t<td colspan='2'>{$type_sel}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan='4' align='center'>\n\t\t\t\t<input type='submit' value='Select' style='font-weight: bold' />\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t</form>"; $where_ar = array(); if ($group_id > 0) { $where_ar[] = "grpid='{$group_id}'"; } if ($type_id > 0) { $where_ar[] = "type_id='{$type_id}'"; } $where_sql = implode(" AND ", $where_ar); if (!empty($where_sql)) { $where_sql .= " AND "; } $sql = "\n\tSELECT id, des, serial, serial2, nonserial, saledate, saleamt\n\tFROM cubit.assets_prev\n\tWHERE {$where_sql} div='" . USER_DIV . "' AND remaction='Sale'"; $sale_rslt = db_exec($sql) or errDie("Unable to retrieve sales."); $sale_out = ""; while ($sale_data = pg_fetch_array($sale_rslt)) { if ($sale_data["nonserial"]) { $qty_sold = $sale_data["serial2"]; } else { $qty_sold = 1; } $sale_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td>{$sale_data['des']}</td>\n\t\t\t<td>{$sale_data['serial']}</td>\n\t\t\t<td align='center'>{$qty_sold}</td>\n\t\t\t<td align='center'>{$sale_data['saledate']}</td>\n\t\t\t<td align='right'>" . sprint($sale_data["saleamt"]) . "</td>\n\t\t\t<td align='right'>{$sale_data['accdep']}</td>\n\t\t</tr>"; } if (empty($sale_out)) { $sale_out .= "\n\t\t<tr class='" . bg_class() . "'>\n\t\t\t<td colspan='5'>\n\t\t\t\t<li>No results found from your current selection</li>\n\t\t\t</td>\n\t\t</tr>"; } $OUTPUT .= "\n\t<table " . TMPL_tblDflts . ">\n\t\t<tr>\n\t\t\t<th>Asset</th>\n\t\t\t<th>Serial</th>\n\t\t\t<th>Qty Sold</th>\n\t\t\t<th>Sale Date</th>\n\t\t\t<th>Amount</th>\n\t\t\t<th>Accumulated Depreciation</th>\n\t\t\t<th>Profit / Loss</th>\n\t\t</tr>\n\t\t{$sale_out}\n\t</table>\n\t</center>"; return $OUTPUT; }
function seluse() { $types = "\n\t\t<select name='type'>\n\t\t\t<option value='79'>INPUT</option>\n\t\t\t<option value='80'>OUTPUT</option>\n\t\t</select>"; db_conn("cubit"); $Sl = "SELECT * FROM vatcodes ORDER BY code"; $Ry = db_exec($Sl) or errDie("Unable to vat codes."); $Out = "\n\t\t<h3>VAT Report</h3>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t<input type='hidden' name='key' value='report'>\n\t\t\t<tr>\n\t\t\t\t<th colspan='2'>Report Criteria</th>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>Type</td>\n\t\t\t\t<td>{$types}</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>From</td>\n\t\t\t\t<td>" . mkDateSelect("from") . "</td>\n\t\t\t</tr>\n\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t<td>To</td>\n\t\t\t\t<td>" . mkDateSelect("to") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan='2' align='right'><input type='submit' value='View Report »'></td>\n\t\t\t</tr>\n\t\t</form>\n\t\t</table><p>\n\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t<tr class='" . bg_class() . "'><td><a href='index-reports.php'>Financials</a></td></tr>\n\t\t\t<tr class='" . bg_class() . "'><td><a href='index-reports-other.php'>Other Reports</a></td></tr>\n\t\t\t<tr class='" . bg_class() . "'><td><a href='../main.php'>Main Menu</a></td></tr>\n\t\t</table>"; return $Out; }
function display() { extract($_REQUEST); $fields = array(); $fields["search"] = ""; $fields["type_id"] = 0; $fields["from_year"] = date("Y"); $fields["from_month"] = date("m"); $fields["from_day"] = date("d"); $fields["to_year"] = date("Y"); $fields["to_month"] = date("m"); $fields["to_day"] = date("t"); extract($fields, EXTR_SKIP); if ($type_id) { $type_sql = "AND assets.type_id='{$type_id}'"; } else { $type_sql = ""; } $sql = "SELECT qty, des, serial, customers.cusnum, customers.cusname,\r\n\t\t\t\tcustomers.surname, to_date, invnum, hire_invitems.invid,\r\n\t\t\t\thire_invitems.id, done, printed, grpname, name\r\n\t\t\t\tFROM hire.hire_invitems\r\n\t\t\t\t\tLEFT JOIN cubit.assets\r\n\t\t\t\t\t\tON hire_invitems.asset_id = assets.id\r\n\t\t\t\t\tLEFT JOIN hire.hire_invoices\r\n\t\t\t\t\t\tON hire_invitems.invid = hire_invoices.invid\r\n\t\t\t\t\tLEFT JOIN cubit.customers\r\n\t\t\t\t\t\tON hire_invoices.cusnum = customers.cusnum\r\n\t\t\t\t\tLEFT JOIN cubit.assetgrp\r\n\t\t\t\t\t\tON assets.grpid=assetgrp.grpid\r\n\t\t\t\t\tLEFT JOIN cubit.asset_types\r\n\t\t\t\t\t\tON assets.type_id=asset_types.id\r\n\t\t\t\tWHERE done='y' {$type_sql} AND remaction IS NULL AND\r\n\t\t\t\t\tprinted='y' AND (cast(qty as text) ILIKE '%{$search}%' OR\r\n\t\t\t\t\tserial ILIKE '%{$search}%' OR\r\n\t\t\t\t\tcustomers.cusname ILIKE '{$search}%' OR\r\n\t\t\t\t\tcustomers.surname ILIKE '{$search}%' OR\r\n\t\t\t\t\tcast(to_date as text) ILIKE '%{$search}%' OR\r\n\t\t\t\t\tcast(invnum as text) ILIKE '%{$search}%'\r\n\t\t\t\t\tOR grpname ILIKE '%{$search}%' OR name ILIKE '%{$search}%')\r\n\t\t\t\tORDER BY des ASC"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $sql = "SELECT id, name FROM cubit.asset_types"; $type_rslt = db_exec($sql) or errDie("Unable to retrieve asset types."); $type_sel = "<select name='type_id' onchange='javascript:document.form.submit()'\r\n\t\t\t\t style='width: 100%'>"; $type_sel .= "<option value='0'>[All]</option>"; while ($type_data = pg_fetch_array($type_rslt)) { if ($type_data["id"] == $type_id) { $sel = "selected='t'"; } else { $sel = ""; } $type_sel .= "\r\n\t\t<option value='{$type_data['id']}' {$sel}>\r\n\t\t\t{$type_data['name']}\r\n\t\t</option>"; } $type_sel .= "</select>"; $hired_out = ""; while ($asset_data = pg_fetch_array($asset_rslt)) { $hired_out .= "<tr class='" . bg_class() . "'>\r\n\t\t\t<td align='center'>\r\n\t\t\t\t<a href='javascript:popupOpen" . "(\"hire-invoice-new.php?invid={$asset_data['invid']}\")'>\r\n\t\t\t\t\tH" . getHirenum($asset_data["invid"], 1) . "\r\n\t\t\t\t</a>\r\n\t\t\t</td>\r\n\t\t\t<td>{$asset_data['grpname']}</td>\r\n\t\t\t<td>{$asset_data['name']}</td>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td>{$asset_data['serial']}</td>\r\n\t\t\t<td align='center'>{$asset_data['qty']}</td>\r\n\t\t\t<td>{$asset_data['cusname']} {$asset_data['surname']}</td>\r\n\t\t\t<td align='center'>" . returnDate($asset_data["id"]) . "</td>\r\n\t\t</tr>"; } // Display something atleast, even though we've got no results. if (empty($hired_out)) { $hired_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='8'><li>No results found.</li></td>\r\n\t\t</tr>"; } // Available assets ------------------------------------------------------- $sql = "SELECT grpname, name, des, assets.id, serial2\r\n\t\t\tFROM cubit.assets\r\n\t\t\t\tLEFT JOIN cubit.assetgrp ON assets.grpid=assetgrp.grpid\r\n\t\t\t\tLEFT JOIN cubit.asset_types ON assets.type_id=asset_types.id\r\n\t\t\tWHERE remaction is NULL AND (grpname ILIKE '%{$search}%' OR\r\n\t\t\t\tname ILIKE '%{$search}%' OR des ILIKE '%{$search}%') {$type_sql}\r\n\t\t\tORDER BY des ASC"; $asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets."); $available_out = ""; while ($asset_data = pg_fetch_array($asset_rslt)) { if (isHired($asset_data["id"])) { continue; } $available_out .= "\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>{$asset_data['grpname']}</td>\r\n\t\t\t<td>{$asset_data['name']}</td>\r\n\t\t\t<td>{$asset_data['des']}</td>\r\n\t\t\t<td>" . getSerial($asset_data["id"]) . "</td>\r\n\t\t\t<td>" . getUnits($asset_data["id"]) . "</td>\r\n\t\t</tr>"; } if (empty($available_out)) { $available_out = "<tr class='" . bg_class() . "'>\r\n\t\t\t<td colspan='5'><li>No results found.</li></td>\r\n\t\t</tr>"; } $OUTPUT = "<center>\r\n\t<h3>Asset Report</th>\r\n\t<br /><br />\r\n\t<form method='post' action='" . SELF . "' name='form'>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th colspan='4'>Date Range</th>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'>\r\n\t\t\t<td>" . mkDateSelect("from", $from_year, $from_month, $from_day) . "</td>\r\n\t\t\t<td> <b>To</b> </td>\r\n\t\t\t<td>" . mkDateSelect("to", $to_year, $to_month, $to_day) . "</td>\r\n\t\t\t<td><input type='submit' value='Select' /></td>\r\n\t\t</tr>\r\n\t\t<tr class='" . bg_class() . "'><td colspan='4' align='center'>\r\n\t\t<table " . TMPL_tblDflts . ">\r\n\t\t\t<tr>\r\n\t\t\t\t<th colspan='2'>Search</th>\r\n\t\t\t\t<th>Asset Type</th>\r\n\t\t\t</tr>\r\n\t\t\t<tr>\r\n\t\t\t\t<td><input type='text' name='search' value='{$search}' /></td>\r\n\t\t\t\t<td><input type='submit' value='Search' /></td>\r\n\t\t\t\t<td>{$type_sel}</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t\t</td></tr>\r\n\t</table>\r\n\t</form>\r\n\t<h3>Hired Out</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Hire No</th>\r\n\t\t\t<th>Asset Group</th>\r\n\t\t\t<th>Asset Type</th>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Qty</th>\r\n\t\t\t<th>Customer</th>\r\n\t\t\t<th>Expected Return</th>\r\n\t\t</tr>\r\n\t\t{$hired_out}\r\n\t</table>\r\n\t<h3>Available</h3>\r\n\t<table " . TMPL_tblDflts . ">\r\n\t\t<tr>\r\n\t\t\t<th>Asset Group</th>\r\n\t\t\t<th>Asset Type</th>\r\n\t\t\t<th>Asset</th>\r\n\t\t\t<th>Serial</th>\r\n\t\t\t<th>Qty</th>\r\n\t\t</tr>\r\n\t\t{$available_out}\r\n\t</table>"; return $OUTPUT; }