include_once($path_to_root . '/installed_extensions.php');
class front_accounting
- {
+ {
var $user;
var $settings;
var $applications;
{
}
function add_application(&$app)
- {
- if ($app->enabled) // skip inactive modules
- $this->applications[$app->id] = &$app;
- }
+ {
+ if ($app->enabled) // skip inactive modules
+ $this->applications[$app->id] = &$app;
+ }
function get_application($id)
- {
- if (isset($this->applications[$id]))
- return $this->applications[$id];
- return null;
- }
+ {
+ if (isset($this->applications[$id]))
+ return $this->applications[$id];
+ return null;
+ }
function get_selected_application()
{
if (isset($this->selected_application))
$this->add_application(new setup_app());
}
-}
+ }
case "t+": // ditto & increase base amount
case "t-": // ditto & reduce base amount
if (substr($row['action'], 0, 1) != 'T')
- $totrate += get_tax_type_default_rate($row['dest_id']);
+ $totrate += get_tax_type_rate($row['dest_id']);
}
}
$first = true;
// Fill background
imagefill($this->img, 0, 0, $this->color['background']);
- //imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $this->color['background']);
- //if ($border)
- // imagerectangle($this->img, 0, 0, $this->width-1, $this->height-1, imagecolorallocate($this->img, 100, 150, 200));
// Draw title
if (!empty($this->title))
if ($len2 < $len1)
$len2 += ($len1-$len2-1);
$less = 7 * $len2;
- //$this->_imagestring($this->img, $this->size, ($x1-$less-7), ($y2-7), $value, $this->color['axis_values']);
$this->_imagestring($this->img, $this->size, ($x1-$less-7), ($y2-7), $value, $this->color['axis_values']);
}
}
// Axis X
- //$this->_imagestring($this->img, $this->size, $this->graphic_area_x2+10, $this->graphic_area_y2+3, $this->axis_x, $this->color['title']);
$this->_imagestring($this->img, $this->size, $this->graphic_area_x2+40, $this->graphic_area_y2+3, $this->axis_x, $this->color['title']);
imageline($this->img, $this->graphic_area_x1, $this->graphic_area_y2, $this->graphic_area_x2, $this->graphic_area_y2, $this->color['axis_line']);
// Axis Y
imageline($this->img, ($x2+1), ($y1-1), ($x2+1), $y2, $this->color['bars_shadow']);
imageline($this->img, ($x2+2), ($y1-1), ($x2+2), $y2, $this->color['bars_shadow']);
imagefilledrectangle($this->img, $x1, $y1, $x2, $y2, $this->color['bars']);
- //$this->_imagestring($this->img, $this->size, ((($x1+$x2)/2) - (strlen($parameter)*7/2)), ($y2+2), $parameter, $this->color['axis_values'], $alt);
$this->_imagestring($this->img, $this->size, $x1, ($y2+2), $parameter, $this->color['axis_values'], $alt);
}
}
imagefilledrectangle($this->img, $x1, $y1, $x2, $y2, $this->color['bars']);
$this->_imagestring($this->img, $this->size, ($x2+7), ($y1+2), $this->number_formated($this->y[$i], $this->dec2), $this->color['bars_shadow']);
- //$this->_imagestring($this->img, $this->size, ($x1 - ((strlen($parameter)*7)+7)), ($y1+2), $parameter, $this->color['axis_values']);
$this->_imagestring($this->img, $this->size, 30, ($y1+2), $parameter, $this->color['axis_values']);
}
}
{
imageline($this->img, $x[$i], ($this->graphic_area_y1+10), $x[$i], ($this->graphic_area_y2-1), $this->color['bg_lines']);
}
- //$this->_imagestring($this->img, $this->size, ($x[$i] - (strlen($parameter)*7/2 )), ($this->graphic_area_y2+2), $parameter, $this->color['axis_values'], $alt);
$this->_imagestring($this->img, $this->size, $x[$i], ($this->graphic_area_y2+2), $parameter, $this->color['axis_values'], $alt);
$x[$i+1] = $x[$i] + 40;
for ($i = $this->h3d; $i >= 0; $i--)
{
- //imagearc($this->img, $center_x, ($center_y+$i), $width, $height, $start, ($start+$size), $this->color[$color]);
if ($size >= 1)
imagefilledarc($this->img, $center_x, ($center_y+$i), $width, $height, $start, ($start+$size), $this->color[$color], IMG_ARC_NOFILL);
}
{
// Office
case 1:
- //$this->color['title'] = imagecolorallocate($this->img, 50, 50, 50);
$this->color['title'] = imagecolorallocate($this->img, 40, 70, 130);
- //$this->color['background'] = imagecolorallocate($this->img, 238, 255, 238);
$this->color['background'] = imagecolorallocate($this->img, 255, 255, 255);
$this->color['axis_values'] = imagecolorallocate($this->img, 50, 50, 50);
$this->color['axis_line'] = imagecolorallocate($this->img, 100, 100, 100);
// Spring
case 3:
$this->color['title'] = imagecolorallocate($this->img, 250, 50, 50);
- //$this->color['background'] = imagecolorallocate($this->img, 250, 250, 220);
$this->color['background'] = imagecolorallocate($this->img, 255, 255, 255);
$this->color['axis_values'] = imagecolorallocate($this->img, 50, 150, 50);
$this->color['axis_line'] = imagecolorallocate($this->img, 50, 100, 50);
$string = mb_convert_encoding($string, 'UTF-8', $this->encoding);
}
- // New 2014-06-26 Joe Hunt for handling ev. RTL languages
+ // Handling ev. RTL languages
if ($alt)
{
if ($this->encoding == 'UTF-8' && is_arabic($string))
else
$size = 12;
$y += $size + 3;
- //if ($alt)
- // $angle = -15;
- //else
- $angle = 0;
+ $angle = 0;
imagettftext($img, $size, $angle, $x, $y + $alt, $col, $this->fontfile, $string);
}
$this->FontFamily = 'helvetica';
$this->FontStyle = '';
$this->FontSizePt = 12;
-// $this->utf8Bidi(array(""));
}
$this->unique_name = uniqid('').".xls";
$this->path = company_path(). '/pdf_files';
$this->Spreadsheet_Excel_Writer_Workbook($this->path."/".$this->unique_name);
- //$this->setCountry(48);
if ($this->code != "iso-8859-1")
$this->setVersion(8); // set biff version to 8 (0x0006 internal)
$this->sheet =& $this->addWorksheet($this->worksheetNameGenerator($this->title));
{
if (!isset($this->formatAmount[$dec]))
{
- //global $thoseps,$decseps;
$dec = (int)$dec;
- //$tsep = $thoseps[user_tho_sep()];
- //$dsep = $decseps[user_dec_sep()];
$tsep = ',';
$dsep = '.';
$format = "###{$tsep}###{$tsep}###{$tsep}##0";
*/
function SetCommonData($myrow, $branch, $sales_order, $bankaccount, $doctype, $contacts)
{
-// $this->formData = array_merge($myrow, $branch, $sales_order,
-// $bank_account, array('doctype' => $doctype));
$this->formData = array();
$datnames = array(
$footerCol = $this->leftMargin + PAGE_NUM_WIDTH;
$footerRow = $this->bottomMargin - FOOTER_MARGIN;
- // Calling this function generates a new PDF page after the first instance
-// {
-// // TODO: experimenting with line drawing to highlight current period
-// $this->SetLineWidth(1);
-// $this->LineTo($this->cols[3], 33, $this->cols[3], 534);
-// $this->LineTo($this->cols[4], 33, $this->cols[4], 534);
-// $this->SetLineWidth(0.1);
-
-// $this->newPage();
-// }
$this->row = $this->pageHeight - $this->topMargin;
// Set the color of dividing lines we'll draw
}
// do not use standard filenames or your sensitive company data
// are world readable
-// if ($email == 1)
-// $fname = $dir.'/'.$this->filename;
-// else
$fname = $dir.'/'.uniqid('').'.pdf';
$this->Output($fname, 'F');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
-// $this->Stream(basename($fname));
$this->Stream($this->filename);
}
} else { // send report to network printer
break;
default:
return null;
-// default: $ar = array();
}
return print_link($link_text, $rep, $ar, "", $icon, $class, $id);
}
}
}
- else // saved parameters 2010-10-16 Joe Hunt
+ else // saved parameters
$date = $_POST[$name];
$st = "<input type='text' name='$name' value='$date'>";
if (user_use_date_picker())
$tag_type = TAG_ACCOUNT;
else
$tag_type = TAG_DIMENSION;
- //return tag_list($name, 5, $tag_type, true, false, _("No tags"));
return tag_list($name, 5, $tag_type, true);
}
//----------------------------------------------------------------------------------------------------
-// trial_inquiry_controls();
print_customer_balances();
function get_open_balance($debtorno, $to)
{
global $path_to_root, $systypes_array, $SysPrefs;
- $to = $_POST['PARAM_0'];
- $fromcust = $_POST['PARAM_1'];
- $currency = $_POST['PARAM_2'];
- $show_all = $_POST['PARAM_3'];
+ $to = $_POST['PARAM_0'];
+ $fromcust = $_POST['PARAM_1'];
+ $currency = $_POST['PARAM_2'];
+ $show_all = $_POST['PARAM_3'];
$summaryOnly = $_POST['PARAM_4'];
- $no_zeros = $_POST['PARAM_5'];
- $graphics = $_POST['PARAM_6'];
- $comments = $_POST['PARAM_7'];
+ $no_zeros = $_POST['PARAM_5'];
+ $graphics = $_POST['PARAM_6'];
+ $comments = $_POST['PARAM_7'];
$orientation = $_POST['PARAM_8'];
$destination = $_POST['PARAM_9'];
if ($destination)
$rep->NewLine();
}
$rep->NewLine();
- // Here starts the new report lines 2010-11-02 Joe Hunt
+ // Here starts the new report lines
$contacts = get_contacts_for_branch($myrow['branch_code']);
$rep->TextCol(0, 1, $myrow['name']);
$rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']);
if ($newrow != 0 && $newrow < $rep->row)
$rep->row = $newrow;
$rep->NewLine();
- /*
- $rep->TextCol(0, 1, $myrow['name']);
- $adr = Explode("\n", $myrow['address']);
- $count1 = count($adr);
- for ($i = 0; $i < $count1; $i++)
- $rep->TextCol(0, 1, $adr[$i], 0, ($i + 1) * $rep->lineHeight);
- $count1++;
- $rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']);
- if ($more != 0.0 || $less != 0.0)
- $rep->TextCol(1, 2, _('Turnover') . ": " . number_format2($turnover, $dec), 0, $rep->lineHeight);
- $rep->TextCol(2, 3, $myrow['br_name']);
-
- $contacts = get_branch_contacts($myrow['branch_code']);
- if (isset($contacts[0]))
- {
- $rep->TextCol(2, 3, $contacts[0]['name'], 0, $rep->lineHeight);
- $rep->TextCol(2, 3, _('Ph') . ": " . $contacts[0]['phone'], 0, 2 * $rep->lineHeight);
- $rep->TextCol(2, 3, _('Fax') . ": " . $contacts[0]['fax'], 0, 3 * $rep->lineHeight);
- }
- $adr = Explode("\n", $myrow['br_address']);
- $count2 = count($adr);
- for ($i = 0; $i < $count2; $i++)
- $rep->TextCol(3, 4, $adr[$i], 0, ($i + 1) * $rep->lineHeight);
- //$rep->TextCol(3, 4, $myrow['email'], 0, ($count2 + 1) * $rep->lineHeight);
- $count2++;
- $count1 = Max($count1, $count2);
- $count1 = Max($count1, 4);
- $rep->NewLine($count3);
- */
$rep->Line($rep->row + 8);
$rep->NewLine(0, 3);
}
if (isset($prepayments))
{
// Partial invoices table
- //$rep->NewLine();
$rep->TextCol(0, 3,_("Prepayments invoiced to this order up to day:"));
$rep->TextCol(0, 3, str_pad('', 150, '_'));
$rep->cols[2] -= 20;
$rep->TextCol(6, 7, $DisplayNet, -2);
}
$rep->row = $newrow;
- //$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->NewPage();
}
$image = company_path(). "/images/" . item_img_name($myrow2['stk_code']) . ".jpg";
if (file_exists($image))
{
- //$rep->NewLine();
if ($rep->row - $SysPrefs->pic_height < $rep->bottomMargin)
$rep->NewPage();
$rep->AddImage($image, $rep->cols[1], $rep->row - $SysPrefs->pic_height, 0, $SysPrefs->pic_height);
$rep->NewLine();
}
}
- //$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->NewPage();
}
for ($i = $from; $i <= $to; $i++)
{
- if (!exists_customer_trans(ST_CUSTCREDIT, $i))
+ if (!exists_customer_trans(ST_CUSTCREDIT, $i))
+ continue;
+ $sign = -1;
+ $myrow = get_customer_trans($i, ST_CUSTCREDIT);
+ if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) {
+ continue;
+ }
+ $baccount = get_default_bank_account($myrow['curr_code']);
+ $params['bankaccount'] = $baccount['id'];
+
+ $branch = get_branch($myrow["branch_code"]);
+ $branch['disable_branch'] = $paylink; // helper
+ $sales_order = null;
+ if ($email == 1)
+ {
+ $rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
+ $rep->title = _('CREDIT NOTE');
+ $rep->filename = "CreditNote" . $myrow['reference'] . ".pdf";
+ }
+ $rep->currency = $cur;
+ $rep->Font();
+ $rep->Info($params, $cols, null, $aligns);
+
+ $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
+ $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_CUSTCREDIT, $contacts);
+ $rep->SetHeaderType('Header2');
+ $rep->NewPage();
+
+ $result = get_customer_trans_details(ST_CUSTCREDIT, $i);
+ $SubTotal = 0;
+ while ($myrow2=db_fetch($result))
+ {
+ if ($myrow2["quantity"] == 0)
continue;
- $sign = -1;
- $myrow = get_customer_trans($i, ST_CUSTCREDIT);
- if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) {
+
+ $Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
+ $SubTotal += $Net;
+ $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
+ $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
+ $DisplayNet = number_format2($Net,$dec);
+ if ($myrow2["discount_percent"]==0)
+ $DisplayDiscount ="";
+ else
+ $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
+ $rep->TextCol(0, 1, $myrow2['stock_id'], -2);
+ $oldrow = $rep->row;
+ $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2);
+ $newrow = $rep->row;
+ $rep->row = $oldrow;
+ $rep->TextCol(2, 3, $DisplayQty, -2);
+ $rep->TextCol(3, 4, $myrow2['units'], -2);
+ $rep->TextCol(4, 5, $DisplayPrice, -2);
+ $rep->TextCol(5, 6, $DisplayDiscount, -2);
+ $rep->TextCol(6, 7, $DisplayNet, -2);
+ $rep->row = $newrow;
+ if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+ $rep->NewPage();
+ }
+
+ $memo = get_comments_string(ST_CUSTCREDIT, $i);
+ if ($memo != "")
+ {
+ $rep->NewLine();
+ $rep->TextColLines(1, 5, $memo, -2);
+ }
+
+ $DisplaySubTot = number_format2($SubTotal,$dec);
+ $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
+
+ $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
+ $doctype = ST_CUSTCREDIT;
+
+ $rep->TextCol(3, 6, _("Sub-total"), -2);
+ $rep->TextCol(6, 7, $DisplaySubTot, -2);
+ $rep->NewLine();
+ $rep->TextCol(3, 6, _("Shipping"), -2);
+ $rep->TextCol(6, 7, $DisplayFreight, -2);
+ $rep->NewLine();
+ $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i);
+ $first = true;
+ while ($tax_item = db_fetch($tax_items))
+ {
+ if ($tax_item['amount'] == 0)
continue;
- }
- $baccount = get_default_bank_account($myrow['curr_code']);
- $params['bankaccount'] = $baccount['id'];
+ $DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
- $branch = get_branch($myrow["branch_code"]);
- $branch['disable_branch'] = $paylink; // helper
- $sales_order = null;
- if ($email == 1)
- {
- $rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
- $rep->title = _('CREDIT NOTE');
- $rep->filename = "CreditNote" . $myrow['reference'] . ".pdf";
- }
- $rep->currency = $cur;
- $rep->Font();
- $rep->Info($params, $cols, null, $aligns);
-
- $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
- $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_CUSTCREDIT, $contacts);
- $rep->SetHeaderType('Header2');
- $rep->NewPage();
-
- $result = get_customer_trans_details(ST_CUSTCREDIT, $i);
- $SubTotal = 0;
- while ($myrow2=db_fetch($result))
- {
- if ($myrow2["quantity"] == 0)
- continue;
-
- $Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
- user_price_dec());
- $SubTotal += $Net;
- $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
- $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
- $DisplayNet = number_format2($Net,$dec);
- if ($myrow2["discount_percent"]==0)
- $DisplayDiscount ="";
- else
- $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
- $rep->TextCol(0, 1, $myrow2['stock_id'], -2);
- $oldrow = $rep->row;
- $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2);
- $newrow = $rep->row;
- $rep->row = $oldrow;
- $rep->TextCol(2, 3, $DisplayQty, -2);
- $rep->TextCol(3, 4, $myrow2['units'], -2);
- $rep->TextCol(4, 5, $DisplayPrice, -2);
- $rep->TextCol(5, 6, $DisplayDiscount, -2);
- $rep->TextCol(6, 7, $DisplayNet, -2);
- $rep->row = $newrow;
- //$rep->NewLine(1);
- if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
- $rep->NewPage();
- }
+ if ($SysPrefs->suppress_tax_rates() == 1)
+ $tax_type_name = $tax_item['tax_type_name'];
+ else
+ $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
- $memo = get_comments_string(ST_CUSTCREDIT, $i);
- if ($memo != "")
+ if ($myrow['tax_included'])
{
- $rep->NewLine();
- $rep->TextColLines(1, 5, $memo, -2);
- }
-
- $DisplaySubTot = number_format2($SubTotal,$dec);
- $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec);
-
- $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
- $doctype = ST_CUSTCREDIT;
-
- $rep->TextCol(3, 6, _("Sub-total"), -2);
- $rep->TextCol(6, 7, $DisplaySubTot, -2);
- $rep->NewLine();
- $rep->TextCol(3, 6, _("Shipping"), -2);
- $rep->TextCol(6, 7, $DisplayFreight, -2);
- $rep->NewLine();
- $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i);
- $first = true;
- while ($tax_item = db_fetch($tax_items))
- {
- if ($tax_item['amount'] == 0)
- continue;
- $DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
-
- if ($SysPrefs->suppress_tax_rates() == 1)
- $tax_type_name = $tax_item['tax_type_name'];
- else
- $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
-
- if ($myrow['tax_included'])
- {
- if ($SysPrefs->alternative_tax_include_on_docs() == 1)
- {
- if ($first)
- {
- $rep->TextCol(3, 6, _("Total Tax Excluded"), -2);
- $rep->TextCol(6, 7, number_format2($sign*$tax_item['net_amount'], $dec), -2);
- $rep->NewLine();
- }
- $rep->TextCol(3, 6, $tax_type_name, -2);
- $rep->TextCol(6, 7, $DisplayTax, -2);
- $first = false;
- }
- else
- $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2);
- }
- else
- {
+ if ($SysPrefs->alternative_tax_include_on_docs() == 1)
+ {
+ if ($first)
+ {
+ $rep->TextCol(3, 6, _("Total Tax Excluded"), -2);
+ $rep->TextCol(6, 7, number_format2($sign*$tax_item['net_amount'], $dec), -2);
+ $rep->NewLine();
+ }
$rep->TextCol(3, 6, $tax_type_name, -2);
$rep->TextCol(6, 7, $DisplayTax, -2);
+ $first = false;
}
- $rep->NewLine();
- }
- $rep->NewLine();
- $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] +
- $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec);
- $rep->Font('bold');
- $rep->TextCol(3, 6, _("TOTAL CREDIT"), - 2);
- $rep->TextCol(6, 7, $DisplayTotal, -2);
- $words = price_in_words($myrow['Total'], ST_CUSTCREDIT);
- if ($words != "")
- {
- $rep->NewLine(1);
- $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
- }
- $rep->Font();
- if ($email == 1)
+ else
+ $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2);
+ }
+ else
{
- $myrow['dimension_id'] = $paylink; // helper for pmt link
- $rep->End($email);
+ $rep->TextCol(3, 6, $tax_type_name, -2);
+ $rep->TextCol(6, 7, $DisplayTax, -2);
}
+ $rep->NewLine();
+ }
+ $rep->NewLine();
+ $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] +
+ $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec);
+ $rep->Font('bold');
+ $rep->TextCol(3, 6, _("TOTAL CREDIT"), - 2);
+ $rep->TextCol(6, 7, $DisplayTotal, -2);
+ $words = price_in_words($myrow['Total'], ST_CUSTCREDIT);
+ if ($words != "")
+ {
+ $rep->NewLine(1);
+ $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+ }
+ $rep->Font();
+ if ($email == 1)
+ {
+ $myrow['dimension_id'] = $paylink; // helper for pmt link
+ $rep->End($email);
+ }
}
if ($email == 0)
$rep->End();
function print_supplier_balances()
{
- global $path_to_root, $systypes_array;
-
- $from = $_POST['PARAM_0'];
- $to = $_POST['PARAM_1'];
- $fromsupp = $_POST['PARAM_2'];
- $show_balance = $_POST['PARAM_3'];
- $currency = $_POST['PARAM_4'];
- $no_zeros = $_POST['PARAM_5'];
- $comments = $_POST['PARAM_6'];
+ global $path_to_root, $systypes_array;
+
+ $from = $_POST['PARAM_0'];
+ $to = $_POST['PARAM_1'];
+ $fromsupp = $_POST['PARAM_2'];
+ $show_balance = $_POST['PARAM_3'];
+ $currency = $_POST['PARAM_4'];
+ $no_zeros = $_POST['PARAM_5'];
+ $comments = $_POST['PARAM_6'];
$orientation = $_POST['PARAM_7'];
$destination = $_POST['PARAM_8'];
if ($destination)
1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
2 => array('text' => _('Supplier'), 'from' => $supp, 'to' => ''),
3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''),
- 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
+ 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
$rep = new FrontReport(_('Supplier Balances'), "SupplierBalances", user_pagesize(), 9, $orientation);
if ($orientation == 'L')
function print_payment_report()
{
- global $path_to_root, $systypes_array;
+ global $path_to_root, $systypes_array;
- $to = $_POST['PARAM_0'];
- $fromsupp = $_POST['PARAM_1'];
- $currency = $_POST['PARAM_2'];
- $no_zeros = $_POST['PARAM_3'];
- $comments = $_POST['PARAM_4'];
+ $to = $_POST['PARAM_0'];
+ $fromsupp = $_POST['PARAM_1'];
+ $currency = $_POST['PARAM_2'];
+ $no_zeros = $_POST['PARAM_3'];
+ $comments = $_POST['PARAM_4'];
$orientation = $_POST['PARAM_5'];
$destination = $_POST['PARAM_6'];
if ($destination)
1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''),
2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''),
3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''),
- 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
+ 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
$rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize(), 9, $orientation);
if ($orientation == 'L')
{
$newrow = 0;
$rep->NewLine();
- // Here starts the new report lines 2013-01-28 Joe Hunt
+ // Here starts the new report lines
$contacts = get_supplier_contacts($myrow['supplier_id']);
$rep->TextCol(0, 1, $myrow['supp_name']);
$rep->TextCol(1, 2, _('Tax_Id') . ": " . $myrow['gst_no']);
{
global $path_to_root, $SysPrefs;
- $category = $_POST['PARAM_0'];
- $location = $_POST['PARAM_1'];
- $pictures = $_POST['PARAM_2'];
- $check = $_POST['PARAM_3'];
- $shortage = $_POST['PARAM_4'];
- $no_zeros = $_POST['PARAM_5'];
- $like = $_POST['PARAM_6'];
- $comments = $_POST['PARAM_7'];
+ $category = $_POST['PARAM_0'];
+ $location = $_POST['PARAM_1'];
+ $pictures = $_POST['PARAM_2'];
+ $check = $_POST['PARAM_3'];
+ $shortage = $_POST['PARAM_4'];
+ $no_zeros = $_POST['PARAM_5'];
+ $like = $_POST['PARAM_6'];
+ $comments = $_POST['PARAM_7'];
$orientation = $_POST['PARAM_8'];
$destination = $_POST['PARAM_9'];
1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''),
2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''),
3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''),
- 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
-
- if ($pictures)
- $user_comp = user_company();
- else
- $user_comp = "";
+ 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
$rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize(), 9, $orientation);
if ($orientation == 'L')
else
$cat = get_category_name($category);
-// if ($location == ALL_TEXT)
-// $location = '';
if ($location == '')
$loc = _('All');
else
$loc = get_location_name($location);
- //$cols = array(0, 100, 300, 365, 440, 540, 640, 715);
$cols = array(0, 60, 220, 240, 310, 380, 450, 520);
$headers = array(_('Category'), _('Description'), _('UOM'), _('Opening'), _('Quantity In'), _('Quantity Out'), _('Balance'));
$res = getTransactions($category, $from, $to);
$total = $grandtotal = 0.0;
- $total1 = $grandtotal1 = 0.0;
- $total2 = $grandtotal2 = 0.0;
$catt = '';
while ($trans=db_fetch($res))
{
$rep->Line($rep->row - 2);
$rep->NewLine();
$rep->NewLine();
- $total = $total1 = $total2 = 0.0;
+ $total = 0.0;
}
$rep->TextCol(0, 1, $trans['category_id']);
$rep->TextCol(1, 7, $trans['cat_description']);
$dec = get_qty_dec($trans['component']);
$rep->TextCol(0, 1, $trans['component']);
$rep->TextCol(1, 2, $trans['CompDescription']);
- //$rep->TextCol(2, 3, $trans['loc_code']);
- //$rep->TextCol(3, 4, $trans['workcentre_added']);
$wc = get_work_centre($trans['workcentre_added']);
$rep->TextCol(2, 3, get_location_name($trans['loc_code']));
$rep->TextCol(3, 4, $wc['name']);
function print_workorders()
{
- global $path_to_root, $SysPrefs, $dflt_lang;
+ global $path_to_root, $dflt_lang;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
$myrow = get_work_order($i);
if ($myrow === false)
continue;
- $date_ = sql2date($myrow["date_"]);
if ($email == 1)
{
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
$result = get_wo_requirements($i);
$rep->TextCol(0, 5,_("Work Order Requirements"), -2);
$rep->NewLine(2);
- $has_marked = false;
while ($myrow2=db_fetch($result))
{
$rep->TextCol(0, 1, $myrow2['stock_id'], -2);
{
$from = date2sql($from);
$to = date2sql($to);
- $sql = "SELECT ".TB_PREF."bank_trans.* FROM ".TB_PREF."bank_trans
- WHERE ".TB_PREF."bank_trans.bank_act = '$account'
+ $sql = "SELECT * FROM ".TB_PREF."bank_trans
+ WHERE bank_act = '$account'
AND trans_date >= '$from'
AND trans_date <= '$to'
- ORDER BY trans_date,".TB_PREF."bank_trans.id";
+ ORDER BY trans_date, id";
return db_query($sql,"The transactions for '$account' could not be retrieved");
}
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
$orientation = ($orientation ? 'L' : 'P');
- $dec = 0;
$cols = array(0, 50, 300, 425, 500);
$orientation = $_POST['PARAM_7'];
$destination = $_POST['PARAM_8'];
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$dimension = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize(), 9, $orientation);
$dec = user_price_dec();
- //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
$cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525);
//------------0--1---2---3----4----5----6----7----8----9----10-------
//-----------------------dim1-dim2-----------------------------------
4 => array('text' => _('Dimension')." 2", 'from' => get_dimension_string($dimension2),
'to' => ''));
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$params = array( 0 => $comments,
1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
$orientation = $_POST['PARAM_5'];
$destination = $_POST['PARAM_6'];
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$year = $_POST['PARAM_0'];
$dimension = $_POST['PARAM_1'];
$orientation = ($orientation ? 'L' : 'P');
$dec = 1;
- //$pdec = user_percent_dec();
$cols = array(0, 40, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510);
//------------0--1---2----3----4----5----6----7----8----10---11---12---13---14---15-
- //$yr = date('Y');
- //$mo = date('m'):
// from now
$sql = "SELECT begin, end, YEAR(end) AS yr, MONTH(end) AS mo FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($year);
$result = db_query($sql, "could not get fiscal year");
5 => array('text' => _('Info'), 'from' => _('Amounts in thousands'),
'to' => ''));
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$params = array( 0 => $comments,
1 => array('text' => _("Year"),
$orientation = $_POST['PARAM_8'];
$destination = $_POST['PARAM_9'];
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$dimension = $_POST['PARAM_2'];
$tags = (isset($_POST['PARAM_3']) ? $_POST['PARAM_3'] : -1);
'from' => get_dimension_string($dimension2), 'to' => ''),
4 => array('text' => _('Tags'), 'from' => get_tag_names($tags), 'to' => ''));
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$params = array( 0 => $comments,
1 => array('text' => _('Period'),'from' => $from, 'to' => $to),
$orientation = $_POST['PARAM_9'];
$destination = $_POST['PARAM_10'];
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$dimension = $_POST['PARAM_3'];
$tags = (isset($_POST['PARAM_4']) ? $_POST['PARAM_4'] : -1);
'from' => get_dimension_string($dimension2), 'to' => ''),
4 => array('text' => _('Tags'), 'from' => get_tag_names($tags), 'to' => ''));
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$params = array( 0 => $comments,
1 => array('text' => _('Period'),'from' => $from, 'to' => $to),
// FA doesn't really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null.
// If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures.
- if (@$SysPregs->clear_trial_balance_opening)
+ if (@$SysPrefs->clear_trial_balance_opening)
{
$open = get_balance($account["account_code"], $dimension, $dimension2, $begin, $begin, false, true);
$offset = min($open['debit'], $open['credit']);
3 => array('text' => _('Dimension')." 2",
'from' => get_dimension_string($dimension2), 'to' => ''));
}
- else if ($dim == 1)
+ elseif ($dim == 1)
{
$params = array( 0 => $comments,
1 => array('text' => _('Period'),'from' => $from, 'to' => $to),
function print_tax_report()
{
- global $path_to_root, $Hooks, $systypes_array;
+ global $path_to_root, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$rep->Info($params, $cols2, $headers2, $aligns2);
- //for ($i = 0; $i < count($cols2); $i++)
- // $rep->cols[$i] = $rep->leftMargin + $cols2[$i];
-
$rep->headers = $headers2;
$rep->aligns = $aligns2;
$rep->NewPage();
_('Comments') => 'TEXTBOX',
_('Orientation') => 'ORIENTATION',
_('Destination') => 'DESTINATION'));
- //$reports->addReport(_('Dimensions'),502, _('Dimension Details'),
- //array( _('Dimension'),'DIMENSIONS'),
- // _('Comments'),'TEXTBOX')));
}
$reports->addReportClass(_('Banking'), RC_BANKING);
$reports->addReport(RC_BANKING, 601, _('Bank &Statement'),
_('Comments') => 'TEXTBOX',
_('Orientation') => 'ORIENTATION',
_('Destination') => 'DESTINATION'));
-//$reports->addReport(RC_GL, 703, _('GL Account Group Summary'),
-// array( _('Comments'),'TEXTBOX')));
if ($dim == 2)
{
_('Orientation') => 'ORIENTATION',
_('Destination') => 'DESTINATION'));
}
-else if ($dim == 1)
+elseif ($dim == 1)
{
$reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
array( _('Start Date') => 'DATEBEGINM',
//--------------------------------------------------------------------------------
start_form();
- /* show all outstanding receipts and credits to be allocated */
+/* show all outstanding receipts and credits to be allocated */
- if (!isset($_POST['customer_id']))
- $_POST['customer_id'] = get_global_customer();
+if (!isset($_POST['customer_id']))
+ $_POST['customer_id'] = get_global_customer();
- echo "<center>" . _("Select a customer: ") . " ";
- echo customer_list('customer_id', $_POST['customer_id'], true, true);
- echo "<br>";
- check(_("Show Settled Items:"), 'ShowSettled', null, true);
- echo "</center><br><br>";
+echo "<center>" . _("Select a customer: ") . " ";
+echo customer_list('customer_id', $_POST['customer_id'], true, true);
+echo "<br>";
+check(_("Show Settled Items:"), 'ShowSettled', null, true);
+echo "</center><br><br>";
- set_global_customer($_POST['customer_id']);
+set_global_customer($_POST['customer_id']);
- if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT))
- {
- unset($_POST['customer_id']);
- }
-
- /*if (isset($_POST['customer_id'])) {
- $custCurr = get_customer_currency($_POST['customer_id']);
- if (!is_company_currency($custCurr))
- echo _("Customer Currency:") . $custCurr;
- }*/
+if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT))
+{
+ unset($_POST['customer_id']);
+}
- $settled = false;
- if (check_value('ShowSettled'))
- $settled = true;
+$settled = false;
+if (check_value('ShowSettled'))
+ $settled = true;
- $customer_id = null;
- if (isset($_POST['customer_id']))
- $customer_id = $_POST['customer_id'];
+$customer_id = null;
+if (isset($_POST['customer_id']))
+ $customer_id = $_POST['customer_id'];
//--------------------------------------------------------------------------------
function systype_name($dummy, $type)
$_POST['trans_date'] = $to;
start_form();
- start_table(TABLESTYLE, "width=50%");
- label_row(_('Description:'), $myrow["description"]);
- label_row(_('Template:'), get_customer_trans_view_str(30, $myrow["order_no"]));
- label_row(_('Number of invoices:'), $count);
- date_row(_('Invoice date:'), 'trans_date');
- text_row(_('Invoice notice:'), 'memo', sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1)),
- 100, 100);
- end_table();
- hidden('from', $from, true);
- hidden('to', $to, true);
- br();
+ start_table(TABLESTYLE, "width=50%");
+ label_row(_('Description:'), $myrow["description"]);
+ label_row(_('Template:'), get_customer_trans_view_str(30, $myrow["order_no"]));
+ label_row(_('Number of invoices:'), $count);
+ date_row(_('Invoice date:'), 'trans_date');
+ text_row(_('Invoice notice:'), 'memo', sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1)),
+ 100, 100);
+ end_table();
+ hidden('from', $from, true);
+ hidden('to', $to, true);
+ br();
submit_center_first('confirmed'.$id, _('Create'), _('Create recurrent invoices'), false, ICON_OK);
submit_center_last('cancel', _('Cancel'), _('Return to recurrent invoices'), false, ICON_ESCAPE);
submit_js_confirm("do_create".$id, sprintf(_("You are about to issue %s invoices.\n Do you want to continue?"), $count));
//--------------------------------------------------------------------------------
function line_start_focus() {
- global $Ajax;
- $Ajax->activate('items_table');
- set_focus('_stock_id_edit');
+ global $Ajax;
+ $Ajax->activate('items_table');
+ set_focus('_stock_id_edit');
}
//-----------------------------------------------------------------------------
end_row();
start_row();
-// if (!isset($_POST['ref']))
-// $_POST['ref'] = $Refs->get_next(11);
-
if ($_SESSION['Items']->trans_no==0) {
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'", false, ST_CUSTCREDIT,
array('customer' => $_SESSION['Items']->customer_id,
}
label_cell(_("Shipping Company"), "class='tableheader2'");
shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']);
-// if (!isset($_POST['sales_type_id']))
-// $_POST['sales_type_id'] = $_SESSION['Items']->sales_type;
-// label_cell(_("Sales Type"), "class='tableheader2'");
-// sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']);
end_row();
end_table();
// Update cart delivery quantities/descriptions
foreach ($_SESSION['Items']->line_items as $line=>$itm) {
if (isset($_POST['Line'.$line])) {
- if($_SESSION['Items']->trans_no) {
- $min = $itm->qty_done;
- $max = $itm->quantity;
- } else {
- $min = 0;
- $max = $itm->quantity - $itm->qty_done;
- }
+ if($_SESSION['Items']->trans_no) {
+ $min = $itm->qty_done;
+ $max = $itm->quantity;
+ } else {
+ $min = 0;
+ $max = $itm->quantity - $itm->qty_done;
+ }
if (check_num('Line'.$line, $min, $max)) {
$_SESSION['Items']->line_items[$line]->qty_dispatched =
end_row();
start_row();
-//if (!isset($_POST['ref']))
-// $_POST['ref'] = $Refs->get_next(ST_CUSTDELIVERY);
-
if ($_SESSION['Items']->trans_no==0) {
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'", false, ST_CUSTDELIVERY,
array('customer' => $_SESSION['Items']->customer_id,
$_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['DispatchDate']);
}
customer_credit_row($_SESSION['Items']->customer_id, $_SESSION['Items']->credit, "class='tableheader2'");
-// 2010-09-03 Joe Hunt
+
$dim = get_company_pref('use_dimension');
if ($dim > 0) {
start_row();
//-----------------------------------------------------------------------------
if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) )
-|| isset($_GET['BatchInvoice'])) {
+ || isset($_GET['BatchInvoice'])) {
processing_start();
} elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) {
check_is_editable(ST_SALESINVOICE, $_GET['ModifyInvoice']);
-/*
- if ( get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) { // 1.xx compatibility hack
- echo"<center><br><b>" . _("There are no delivery notes for this invoice.<br>
- Most likely this invoice was created in Front Accounting version prior to 2.0
- and therefore can not be modified.") . "</b></center>";
- display_footer_exit();
- }
-*/
+
processing_start();
$_SESSION['Items'] = new Cart(ST_SALESINVOICE, $_GET['ModifyInvoice']);
copy_from_cart();
} elseif (isset($_GET['AllocationNumber']) || isset($_GET['InvoicePrepayments'])) {
- check_deferred_income_act(_("You have to set Deferred Income Account in GL Setup to entry prepayment invoices."));
+ check_deferred_income_act(_("You have to set Deferred Income Account in GL Setup to entry prepayment invoices."));
- if (isset($_GET['AllocationNumber']))
- {
- $payments = array(get_cust_allocation($_GET['AllocationNumber']));
+ if (isset($_GET['AllocationNumber']))
+ {
+ $payments = array(get_cust_allocation($_GET['AllocationNumber']));
- if (!$payments || ($payments[0]['trans_type_to'] != ST_SALESORDER))
- {
- display_error(_("Please select correct Sales Order Prepayment to be invoiced and try again."));
- display_footer_exit();
- }
- $order_no = $payments[0]['trans_no_to'];
- }
- else {
- $order_no = $_GET['InvoicePrepayments'];
- $payments = get_payments_for($_GET['InvoicePrepayments'], ST_SALESORDER);
+ if (!$payments || ($payments[0]['trans_type_to'] != ST_SALESORDER))
+ {
+ display_error(_("Please select correct Sales Order Prepayment to be invoiced and try again."));
+ display_footer_exit();
}
- processing_start();
-
- $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
- $_SESSION['Items']->order_no = $order_no;
- $_SESSION['Items']->src_docs = array($order_no);
- $_SESSION['Items']->trans_no = 0;
- $_SESSION['Items']->trans_type = ST_SALESINVOICE;
- $_SESSION['Items']->prepayments = $payments;
- // prepayment invoice has all line quantities as stated on order.
-// foreach($_SESSION['Items']->line_items as &$line)
-// {
-// $line->src_id = $line_id;
-// $line->qty_dispatched = $line->quantity;
-// }
-// unset($line);
- $_SESSION['Items']->update_payments();
-
-// $_SESSION['Items']->alloc = $this_amount;
- copy_from_cart();
+ $order_no = $payments[0]['trans_no_to'];
+ }
+ else {
+ $order_no = $_GET['InvoicePrepayments'];
+ $payments = get_payments_for($_GET['InvoicePrepayments'], ST_SALESORDER);
+ }
+ processing_start();
+
+ $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE);
+ $_SESSION['Items']->order_no = $order_no;
+ $_SESSION['Items']->src_docs = array($order_no);
+ $_SESSION['Items']->trans_no = 0;
+ $_SESSION['Items']->trans_type = ST_SALESINVOICE;
+ $_SESSION['Items']->prepayments = $payments;
+ $_SESSION['Items']->update_payments();
+
+ copy_from_cart();
}
- elseif (!processing_active()) {
+elseif (!processing_active()) {
/* This page can only be called with a delivery for invoicing or invoice no for edit */
display_error(_("This page can only be opened after delivery selection. Please select delivery to invoicing first."));
foreach($delivery_notes as $delivery_num)
{
$myrow = get_customer_trans($delivery_num, 13);
- //$branch = get_branch($myrow["branch_code"]);
- //$sales_order = get_sales_order_header($myrow["order_"]);
-
- //$shipping += $sales_order['freight_cost'];
+
$shipping += $myrow['ov_freight'];
}
$_POST['ChargeFreightCost'] = price_format($shipping);
label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
}
-//label_cells(_("Delivery Notes:"),
-//get_customer_trans_view_str(ST_CUSTDELIVERY, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
-
label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'");
-// 2010-09-03 Joe Hunt
-//if ($dim > 0)
-// label_cells(_("Dimension"), get_dimension_string($_SESSION['Items']->dimension_id), "class='tableheader2'");
if ($dim > 0) {
label_cell(_("Dimension").":", "class='tableheader2'");
$_POST['dimension_id'] = $_SESSION['Items']->dimension_id;
}
date_cells(_("Due Date"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'");
-/*
-if ($dim > 1)
- label_cells(_("Dimension"). " 2", get_dimension_string($_SESSION['Items']->dimension2_id), "class='tableheader2'");
-else if ($dim > 0)
- label_cell(" ", "colspan=2");
-*/
if ($dim > 1) {
label_cell(_("Dimension")." 2:", "class='tableheader2'");
$_POST['dimension2_id'] = $_SESSION['Items']->dimension2_id;
}
}
-// if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001))
-// {
-// display_error(_("The exchange rate must be numeric and greater than zero."));
-// set_focus('_ex_rate');
-// return false;
-// }
-
if (@$_POST['discount'] == "")
{
$_POST['discount'] = 0;
return false;
}
- //if ((input_num('amount') - input_num('discount') <= 0)) {
if (input_num('amount') <= 0) {
display_error(_("The balance of the amount and discount is zero or negative. Please enter valid amounts."));
set_focus('discount');
$_POST['HoldAccount'] = $myrow["dissallow_invoices"];
$_POST['pymt_discount'] = $myrow["pymt_discount"];
- //Chaitanya : 13-OCT-2011 - To support Edit feature
- //If page is called first time and New entry fetch the nex reference number
+ // To support Edit feature
+ // If page is called first time and New entry fetch the nex reference number
if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge']))
$_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT, null, array(
'customer' => get_post('customer_id'), 'date' => get_post('DateBanked')));
//----------------------------------------------------------------------------------------------
$new = 1;
-//Chaitanya : 13-OCT-2011 - To support Edit feature
+// To support Edit feature
if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 )
{
$_POST['trans_no'] = $_GET['trans_no'];
$new = !$_SESSION['alloc']->trans_no;
start_form();
- hidden('trans_no');
+hidden('trans_no');
- start_outer_table(TABLESTYLE2, "width='60%'", 5);
+start_outer_table(TABLESTYLE2, "width='60%'", 5);
- table_section(1);
+table_section(1);
- bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
+bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
- if ($new)
- customer_list_row(_("From Customer:"), 'customer_id', null, false, true);
- else {
- label_cells(_("From Customer:"), $_SESSION['alloc']->person_name, "class='label'");
- hidden('customer_id', $_POST['customer_id']);
- }
+if ($new)
+ customer_list_row(_("From Customer:"), 'customer_id', null, false, true);
+else {
+ label_cells(_("From Customer:"), $_SESSION['alloc']->person_name, "class='label'");
+ hidden('customer_id', $_POST['customer_id']);
+}
- if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
- $_SESSION['alloc']->read();
- $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
- $Ajax->activate('alloc_tbl');
- }
+if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
+ $_SESSION['alloc']->read();
+ $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
+ $Ajax->activate('alloc_tbl');
+}
- if (db_customer_has_branches($_POST['customer_id'])) {
- customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
- } else {
- hidden('BranchID', ANY_NUMERIC);
- }
+if (db_customer_has_branches($_POST['customer_id'])) {
+ customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
+} else {
+ hidden('BranchID', ANY_NUMERIC);
+}
- if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
- $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER);
- $_SESSION['alloc']->read();
- $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
- $Ajax->activate('alloc_tbl');
- }
+if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
+ $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER);
+ $_SESSION['alloc']->read();
+ $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
+ $Ajax->activate('alloc_tbl');
+}
- read_customer_data();
+read_customer_data();
- set_global_customer($_POST['customer_id']);
- if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0)
- display_warning(_("This customer account is on hold."));
- $display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%";
+set_global_customer($_POST['customer_id']);
+if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0)
+ display_warning(_("This customer account is on hold."));
+$display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%";
- table_section(2);
+table_section(2);
- date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
+date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
- ref_row(_("Reference:"), 'ref','' , null, '', ST_CUSTPAYMENT);
+ref_row(_("Reference:"), 'ref','' , null, '', ST_CUSTPAYMENT);
- table_section(3);
+table_section(3);
- $comp_currency = get_company_currency();
- $cust_currency = $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER);
- if (!$cust_currency)
- $cust_currency = $comp_currency;
- $_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']);
+$comp_currency = get_company_currency();
+$cust_currency = $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER);
+if (!$cust_currency)
+ $cust_currency = $comp_currency;
+$_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']);
- if ($cust_currency != $bank_currency)
- {
- amount_row(_("Payment Amount:"), 'bank_amount', null, '', $bank_currency);
- }
+if ($cust_currency != $bank_currency)
+{
+ amount_row(_("Payment Amount:"), 'bank_amount', null, '', $bank_currency);
+}
- amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
+amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
- end_outer_table(1);
+end_outer_table(1);
- div_start('alloc_tbl');
- show_allocatable(false);
- div_end();
+div_start('alloc_tbl');
+show_allocatable(false);
+div_end();
- start_table(TABLESTYLE, "width='60%'");
+start_table(TABLESTYLE, "width='60%'");
- label_row(_("Customer prompt payment discount :"), $display_discount_percent);
+label_row(_("Customer prompt payment discount :"), $display_discount_percent);
- amount_row(_("Amount of Discount:"), 'discount', null, '', $cust_currency);
+amount_row(_("Amount of Discount:"), 'discount', null, '', $cust_currency);
- amount_row(_("Amount:"), 'amount', null, '', $cust_currency);
+amount_row(_("Amount:"), 'amount', null, '', $cust_currency);
- textarea_row(_("Memo:"), 'memo_', null, 22, 4);
- end_table(1);
+textarea_row(_("Memo:"), 'memo_', null, 22, 4);
+end_table(1);
- if ($new)
- submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default');
- else
- submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default');
+if ($new)
+ submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default');
+else
+ submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default');
- br();
+br();
end_form();
end_page();
$line = &$this->line_items[$line_no];
$src_docs[] = $src_type == ST_SALESORDER ? $srcline['order_no'] : $srcline['debtor_trans_no'];
while($srcline['id'] != $line->src_id) // Logic : This will increment the line_items array till sales_order line is matched.
- { // 0002259: Fixes Delivery note bug : Parent constraints not working if sales order line deleted after delivery
+ { // Fixes Delivery note bug : Parent constraints not working if sales order line deleted after delivery
$line_no++;
$line = &$this->line_items[$line_no];
}
if ($type == ST_SALESORDER || $type == ST_SALESQUOTE) { // sales order || sales quotation
read_sales_order($trans_no[0], $this, $type);
} else { // other type of sales transaction
- read_sales_trans($type, $trans_no, $this);
- $this->prepayments = get_payments_for($trans_no[0], $type);
- if ($this->order_no) { // free hand credit notes have no order_no
- $sodata = get_sales_order_header($this->order_no, ST_SALESORDER);
- $this->cust_ref = $sodata["customer_ref"];
- // currently currency is hard linked to debtor account
- // $this->customer_currency = $sodata["curr_code"];
- $this->delivery_to = $sodata["deliver_to"];
- $this->delivery_address = $sodata["delivery_address"];
- // child transaction reedition - update with parent info unless it is freehand
- if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition
- $this->set_parent_constraints($sodata, $trans_no[0]);
- }
+ read_sales_trans($type, $trans_no, $this);
+ $this->prepayments = get_payments_for($trans_no[0], $type);
+ if ($this->order_no) { // free hand credit notes have no order_no
+ $sodata = get_sales_order_header($this->order_no, ST_SALESORDER);
+ $this->cust_ref = $sodata["customer_ref"];
+ // currently currency is hard linked to debtor account
+ $this->delivery_to = $sodata["deliver_to"];
+ $this->delivery_address = $sodata["delivery_address"];
+ // child transaction reedition - update with parent info unless it is freehand
+ if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition
+ $this->set_parent_constraints($sodata, $trans_no[0]);
+ }
}
// convert document into child and prepare qtys for entry
if ($prepare_child)
$this->prepare_child($prepare_child);
} else { // new document
- $this->trans_type = $type;
- $this->trans_no = 0;
- $this->customer_currency = get_company_currency();
- // set new sales document defaults here
- if (get_global_customer() != ALL_TEXT)
- $this->customer_id = get_global_customer();
- else
- $this->customer_id = '';
- $this->document_date = new_doc_date();
- if (!is_date_in_fiscalyear($this->document_date))
- $this->document_date = end_fiscalyear();
- $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today(),
- 'customer' => $this->customer_id));
- if ($type != ST_SALESORDER && $type != ST_SALESQUOTE) // Added 2.1 Joe Hunt 2008-11-12
+ $this->trans_type = $type;
+ $this->trans_no = 0;
+ $this->customer_currency = get_company_currency();
+ // set new sales document defaults here
+ if (get_global_customer() != ALL_TEXT)
+ $this->customer_id = get_global_customer();
+ else
+ $this->customer_id = '';
+ $this->document_date = new_doc_date();
+ if (!is_date_in_fiscalyear($this->document_date))
+ $this->document_date = end_fiscalyear();
+ $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today(),
+ 'customer' => $this->customer_id));
+ if ($type != ST_SALESORDER && $type != ST_SALESQUOTE) // Added 2.1 Joe Hunt 2008-11-12
+ {
+ $dim = get_company_pref('use_dimension');
+ if ($dim > 0)
{
- $dim = get_company_pref('use_dimension');
- if ($dim > 0)
+ if ($this->customer_id == '')
+ $this->dimension_id = 0;
+ else
+ {
+ $cust = get_customer($this->customer_id);
+ $this->dimension_id = $cust['dimension_id'];
+ }
+ if ($dim > 1)
{
if ($this->customer_id == '')
- $this->dimension_id = 0;
+ $this->dimension2_id = 0;
else
- {
- $cust = get_customer($this->customer_id);
- $this->dimension_id = $cust['dimension_id'];
- }
- if ($dim > 1)
- {
- if ($this->customer_id == '')
- $this->dimension2_id = 0;
- else
- $this->dimension2_id = $cust['dimension2_id'];
- }
+ $this->dimension2_id = $cust['dimension2_id'];
}
- }
- if ($type == ST_SALESINVOICE) {
- $this->due_date =
- get_invoice_duedate($this->payment, $this->document_date);
- } else
- $this->due_date =
- add_days($this->document_date, $SysPrefs->default_delivery_required_by());
+ }
+ }
+ if ($type == ST_SALESINVOICE) {
+ $this->due_date =
+ get_invoice_duedate($this->payment, $this->document_date);
+ } else
+ $this->due_date =
+ add_days($this->document_date, $SysPrefs->default_delivery_required_by());
}
$this->credit = get_current_cust_credit($this->customer_id);
}
}
$taxes = get_tax_for_items($items, $prices, $shipping_cost,
- $this->tax_group_id, $this->tax_included, $this->tax_group_array);
+ $this->tax_group_id, $this->tax_included, $this->tax_group_array);
// Adjustment for swiss franken, we always have 5 rappen = 1/20 franken
if ($this->customer_currency == 'CHF') {
*/
function is_prepaid()
{
- return $this->prepaid; //floatcmp($this->prep_amount, 0) > 0;
+ return $this->prepaid;
}
/*
Order is ready for delivery in prepament mode.
$this->item_description = $item_row["description"];
else
$this->item_description = $description;
- //$this->standard_cost = $item_row["material_cost"] + $item_row["labour_cost"] + $item_row["overhead_cost"];
$this->tax_type = $item_row["tax_type_id"];
$this->tax_type_name = $item_row["tax_type_name"];
$this->stock_id = $stock_id;
$company_record = get_company_prefs();
if ($trans_no != 0) {
- delete_comments(ST_CUSTPAYMENT, $trans_no);
- void_bank_trans(ST_CUSTPAYMENT, $trans_no, true);
- void_gl_trans(ST_CUSTPAYMENT, $trans_no, true);
- void_cust_allocations(ST_CUSTPAYMENT, $trans_no, $date_);
+ delete_comments(ST_CUSTPAYMENT, $trans_no);
+ void_bank_trans(ST_CUSTPAYMENT, $trans_no, true);
+ void_gl_trans(ST_CUSTPAYMENT, $trans_no, true);
+ void_cust_allocations(ST_CUSTPAYMENT, $trans_no, $date_);
}
$bank = get_bank_account($bank_account);
$items_added_tax = 0;
$freight_added_tax = 0;
}
- // 2006-06-14. If the Customer Branch AR Account is set to a Bank Account,
+ // If the Customer Branch AR Account is set to a Bank Account,
// the transaction will be settled at once.
if (is_bank_account($branch_data['receivables_account']))
$alloc = $credit_note_total + $items_added_tax + $credit_note->freight_cost + $freight_added_tax;
else
$alloc = 0;
-// $sales_order=$invoice->order_no; //?
-// if (is_array($sales_order)) $sales_order = $sales_order[0]; //?
if (!isset($credit_note->order_no))
$credit_note->order_no = 0;
$credit_note->sales_type, $credit_note->order_no, $credit_note->ship_via,
null, $alloc, 0, $credit_note->dimension_id, $credit_note->dimension2_id,
$credit_note->payment, $credit_note->tax_included);
- // 2008-06-14 extra $alloc, 2008-11-12 dimension_id Joe Hunt
if ($trans_no==0) {
$credit_note->trans_no = array($credit_no=>0);
{
$stock_gl_codes = get_stock_gl_code($order_line->stock_id);
$customer = get_customer($order->customer_id);
- // 2008-08-01. If there is a Customer Dimension, then override with this,
+ // If there is a Customer Dimension, then override with this,
// else take the Item Dimension (if any)
$dim = ($order->dimension_id != $customer['dimension_id'] ? $order->dimension_id :
($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_codes["dimension_id"]));
//Post sales transaction to GL credit sales
- // 2008-06-14. If there is a Branch Sales Account, then override with this,
+ // If there is a Branch Sales Account, then override with this,
// else take the Item Sales Account
if ($branch_data['sales_account'] != "")
$sales_account = $branch_data['sales_account'];
$line_tax = get_full_price_for_item($delivery_line->stock_id, $delivery_line->price,
0, $delivery->tax_included, $delivery->tax_group_array) - $line_taxfree_price;
- //if ($trans_no != 0) // Inserted 2008-09-25 Joe Hunt. This condition is removed after experience by Chaitanya
- $delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id);
+ $delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id);
/* add delivery details for all lines */
write_customer_trans_detail_item(ST_CUSTDELIVERY, $delivery_no, $delivery_line->stock_id,
$stock_gl_code = get_stock_gl_code($delivery_line->stock_id);
- // 2008-08-01. If there is a Customer Dimension, then override with this,
+ // If there is a Customer Dimension, then override with this,
// else take the Item Dimension (if any)
$dim = ($delivery->dimension_id != $customer['dimension_id'] ? $delivery->dimension_id :
($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]));
if ($trans_no == 0) {
$Refs->save(ST_CUSTDELIVERY, $delivery_no, $delivery->reference);
}
-//_vd(get_gl(ST_CUSTDELIVERY, $delivery_no));
-//exit;
hook_db_postwrite($delivery, ST_CUSTDELIVERY);
commit_transaction();
$invoice->sales_type, $sales_order, $invoice->ship_via,
$invoice->due_date, 0, 0, $invoice->dimension_id,
$invoice->dimension2_id, $invoice->payment, $invoice->tax_included, $invoice->prep_amount);
- // 2008-06-14 extra $alloc, 2008-11-12 added dimension_id Joe Hunt
if ($trans_no == 0) {
$invoice->trans_no = array($invoice_no=>0);
if ($invoice_line->line_price() != 0) {
//Post sales transaction to GL credit sales
- // 2008-06-14. If there is a Branch Sales Account, then override with this,
+ // If there is a Branch Sales Account, then override with this,
// else take the Item Sales Account
if (!$invoice->is_prepaid())
$sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']);
- // 2008-08-01. If there is a Customer Dimension, then override with this,
+ // If there is a Customer Dimension, then override with this,
// else take the Item Dimension (if any)
$dim = ($invoice->dimension_id != $customer['dimension_id'] ? $invoice->dimension_id :
($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]));
update_debtor_trans_allocation(ST_CUSTPAYMENT, $pmtno, $invoice->customer_id);
}
}
-//_vd($allocs);
reallocate_payments($invoice_no, ST_SALESINVOICE, $date_, $to_allocate, $allocs);
-//_vd(get_payments_for($sales_order, ST_SALESORDER));
-//_vd(get_payments_for($invoice_no, ST_SALESINVOICE));
-//_vd(get_gl(ST_SALESINVOICE, $invoice_no));
-//_vd(get_customer_trans($invoice_no, ST_SALESINVOICE));
-//_vd(get_sales_order_header($sales_order, ST_SALESORDER));
hook_db_postwrite($invoice, ST_SALESINVOICE);
-//$result = get_trans_tax_details(ST_SALESINVOICE, $invoice_no);
-//while($row=db_fetch($result))
-// _vd($row);
-//exit;
+
commit_transaction();
return $invoice_no;
{
$price = $prices[$base_id][$home_curr] * $factor / $rate;
}
-/*
- if (isset($prices[$sales_type_id][$home_curr]))
- {
- $price = $prices[$sales_type_id][$home_curr] / $rate;
- }
- elseif (isset($prices[$base_id][$currency]))
- {
- $price = $prices[$base_id][$currency] * $factor;
- }
- elseif (isset($prices[$base_id][$home_curr]))
- {
- $price = $prices[$base_id][$home_curr] * $factor / $rate;
- }
-*/
elseif ($num_rows == 0 && $add_pct != -1)
{
$price = get_calculated_price($stock_id, $add_pct);
$qty_dispatched = (float)$qty_dispatched;
-// echo "update line: $line_id, $doc_type, $qty_dispatched";
if ($doc_type == 0)
return false;
else {
function read_sales_trans($doc_type, $trans_no, &$cart)
{
if (!is_array($trans_no) && $trans_no)
- $trans_no = array($trans_no);
+ $trans_no = array($trans_no);
$cart->trans_type = $doc_type;
if (!$trans_no) { // new document
}
customer_branches_list_row(_("Branch:"), $_POST['customer_id'],
- 'branch_id', null, false, true, true, true);
+ 'branch_id', null, false, true, true, true);
- //if (($_SESSION['credit_items']->order_no == 0) ||
- // ($order->customer_id != $_POST['customer_id']) ||
- // ($order->Branch != $_POST['branch_id']))
- // $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
if (($order->customer_id != $_POST['customer_id']) ||
($order->Branch != $_POST['branch_id']))
- {
-
- $old_order = (PHP_VERSION<5) ? $order : clone $order;
- $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
-
- $_POST['Location'] = $order->Location;
- $_POST['deliver_to'] = $order->deliver_to;
- $_POST['delivery_address'] = $order->delivery_address;
- $_POST['phone'] = $order->phone;
- $Ajax->activate('Location');
- $Ajax->activate('deliver_to');
- $Ajax->activate('phone');
- $Ajax->activate('delivery_address');
- // change prices if necessary
- // what about discount in template case?
- if ($old_order->customer_currency != $order->customer_currency) {
- $change_prices = 1;
- }
- if ($old_order->sales_type != $order->sales_type) {
- // || $old_order->default_discount!=$order->default_discount
- $_POST['sales_type_id'] = $order->sales_type;
- $Ajax->activate('sales_type_id');
- $change_prices = 1;
- }
- if ($old_order->dimension_id != $order->dimension_id) {
- $_POST['dimension_id'] = $order->dimension_id;
- $Ajax->activate('dimension_id');
- }
- if ($old_order->dimension2_id != $order->dimension2_id) {
- $_POST['dimension2_id'] = $order->dimension2_id;
- $Ajax->activate('dimension2_id');
- }
- unset($old_order);
- }
+ {
+
+ $old_order = (PHP_VERSION<5) ? $order : clone $order;
+ $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']);
+
+ $_POST['Location'] = $order->Location;
+ $_POST['deliver_to'] = $order->deliver_to;
+ $_POST['delivery_address'] = $order->delivery_address;
+ $_POST['phone'] = $order->phone;
+ $Ajax->activate('Location');
+ $Ajax->activate('deliver_to');
+ $Ajax->activate('phone');
+ $Ajax->activate('delivery_address');
+ // change prices if necessary
+ // what about discount in template case?
+ if ($old_order->customer_currency != $order->customer_currency) {
+ $change_prices = 1;
+ }
+ if ($old_order->sales_type != $order->sales_type) {
+ $_POST['sales_type_id'] = $order->sales_type;
+ $Ajax->activate('sales_type_id');
+ $change_prices = 1;
+ }
+ if ($old_order->dimension_id != $order->dimension_id) {
+ $_POST['dimension_id'] = $order->dimension_id;
+ $Ajax->activate('dimension_id');
+ }
+ if ($old_order->dimension2_id != $order->dimension2_id) {
+ $_POST['dimension2_id'] = $order->dimension2_id;
+ $Ajax->activate('dimension2_id');
+ }
+ unset($old_order);
+ }
set_global_customer($_POST['customer_id']);
if (!isset($_POST['ref']))
}
$Ajax->activate('_ex_rate');
}
- // 2008-11-12 Joe Hunt added dimensions
+ // added dimensions
$dim = get_company_pref('use_dimension');
if ($dim > 0)
dimensions_list_row(_("Dimension").":", 'dimension_id',
$line = &$order->line_items[$line_no];
$line->price = get_price($line->stock_id, $order->customer_currency,
$order->sales_type, $order->price_factor, get_post('OrderDate'));
- // $line->discount_percent = $order->default_discount;
}
$Ajax->activate('items_table');
}
div_start('items_table');
start_table(TABLESTYLE, "width='90%'");
$th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"),
- _("Price"), _("Discount %"), _("Total"),'');
+ _("Price"), _("Discount %"), _("Total"),'');
if (count($order->line_items)) $th[]= '';
}
$item_price = round($item_price, user_price_dec());
- if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id'])
- { // this is sales kit - recurse
- add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'],
- $item_price, $discount);
- }
- else
- { // stock item record eventually with foreign code
-
- // check duplicate stock item
- foreach ($order->line_items as $order_item)
- {
- if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0)
+ if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id'])
+ { // this is sales kit - recurse
+ add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'],
+ $item_price, $discount);
+ }
+ else
+ { // stock item record eventually with foreign code
+
+ // check duplicate stock item
+ foreach ($order->line_items as $order_item)
{
- display_warning(_("For Part :").$item['stock_id']. " "
- . _("This item is already on this document. You have been warned."));
- break;
+ if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0)
+ {
+ display_warning(_("For Part :").$item['stock_id']. " "
+ . _("This item is already on this document. You have been warned."));
+ break;
+ }
}
+ $order->add_to_cart (count($order->line_items), $item['stock_id'],
+ $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description);
}
- $order->add_to_cart (count($order->line_items), $item['stock_id'],
- $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description);
- }
}
}
view_stock_status_cell($stock_item->stock_id);
- //label_cell($stock_item->item_description, "nowrap" );
label_cell($stock_item->item_description );
$dec = get_qty_dec($stock_item->stock_id);
qty_cell($stock_item->qty_dispatched, false, $dec);
if (isset($order) && !$editable)
{
- // can't change the customer/branch if items already received on this order
- //echo $order->customer_name . " - " . $order->deliver_to;
label_row(null, $order->customer_name . " - " . $order->deliver_to);
hidden('customer_id', $order->customer_id);
hidden('branch_id', $order->Branch);
$line = &$order->line_items[$line_no];
$line->price = get_kit_price($line->stock_id, $order->customer_currency,
$order->sales_type, $order->price_factor, get_post('OrderDate'));
- // $line->discount_percent = $order->default_discount;
}
$Ajax->activate('items_table');
}
hidden('item_description', $_POST['item_description']);
label_cell($_POST['item_description']);
}
-// } else {
-// sales_items_list_cells(null,'item_description', null, false, true);
-// }
- //label_cell($order->line_items[$line_no]->item_description, "nowrap");
$Ajax->activate('items_table');
}
else // prepare new line
$disable = get_post('OrderNumber') !== '' || get_post('OrderReference') !== '';
if ($show_dates) {
- $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
- $Ajax->addDisable(true, 'OrdersToDate', $disable);
+ $Ajax->addDisable(true, 'OrdersAfterDate', $disable);
+ $Ajax->addDisable(true, 'OrdersToDate', $disable);
}
$Ajax->activate('orders_tbl');
_("Currency") => array('align'=>'center')
);
if ($_POST['order_view_mode'] == 'OutstandingOnly') {
- //array_substitute($cols, 3, 1, _("Cust Order Ref"));
array_append($cols, array(
array('insert'=>true, 'fun'=>'dispatch_link'),
array('insert'=>true, 'fun'=>'edit_link')));
}
hidden('selected_id', $selected_id);
} elseif ($Mode != 'ADD_ITEM') {
- $_POST['provision'] = percent_format(0);
- $_POST['break_pt'] = price_format(0);
- $_POST['provision2'] = percent_format(0);
+ $_POST['provision'] = percent_format(0);
+ $_POST['break_pt'] = price_format(0);
+ $_POST['provision2'] = percent_format(0);
}
start_table(TABLESTYLE2);
//--------------------------------------------------------------------------------
function line_start_focus() {
- global $Ajax;
+ global $Ajax;
- $Ajax->activate('items_table');
- set_focus('_stock_id_edit');
+ $Ajax->activate('items_table');
+ set_focus('_stock_id_edit');
}
//--------------------------------------------------------------------------------
if ($_SESSION['Items']->some_already_delivered($line_no) == 0) {
$_SESSION['Items']->remove_from_cart($line_no);
} else {
- display_error(_("This item cannot be deleted because some of it has already been delivered."));
+ display_error(_("This item cannot be deleted because some of it has already been delivered."));
}
line_start_focus();
}
else
$ret_tax_array = get_tax_group_items_as_array($tax_group);
- //print_r($ret_tax_array);
-
$tax_array = get_taxes_for_item($stock_id, $ret_tax_array);
// if no exemptions or taxgroup is empty, then no included/excluded taxes
$tax_algorithm = get_company_pref('tax_algorithm');
// first create and set an array with all the tax types of the tax group
if($tax_items_array!=null)
- $ret_tax_array = $tax_items_array;
+ $ret_tax_array = $tax_items_array;
else
- $ret_tax_array = get_tax_group_items_as_array($tax_group);
+ $ret_tax_array = get_tax_group_items_as_array($tax_group);
$dec = user_price_dec();
if ($item_tax['rate'] !== null) {
$index = $item_tax['tax_type_id'];
if ($tax_included == 1) {
- $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec);
- $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec);
+ $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec);
+ $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec);
} else {
- $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec);
- $ret_tax_array[$index]['Net'] += $prices[$i];
+ $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec);
+ $ret_tax_array[$index]['Net'] += $prices[$i];
}
}
}
{
$index = $item_tax['tax_type_id'];
if ($item_tax['rate'] !== null && $ret_tax_array[$index]['rate'] !== null) {
- if($tax_included==1) {
- $ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec);
- $ret_tax_array[$index]['Net'] += $shipping_net;
- } else {
+ if($tax_included==1) {
+ $ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec);
+ $ret_tax_array[$index]['Net'] += $shipping_net;
+ } else {
$ret_tax_array[$index]['Value'] += round2($shipping_cost * $item_tax['rate'] / 100, $dec);
- $ret_tax_array[$index]['Net'] += $shipping_cost;
- }
+ $ret_tax_array[$index]['Net'] += $shipping_cost;
+ }
}
}
}
echo "</tr></table></td></tr>";
}
echo "</table>";
- }
-}
+ }
+ }
$repo_auth = isset($SysPrefs->repo_auth) ? $SysPrefs->repo_auth :
array(
- 'login' => 'anonymous',
- 'pass' => 'password',
- 'host' => 'repo.frontaccounting.eu', // repo server address
- 'branch' => '2.4' // Repository branch for current sources version
+ 'login' => 'anonymous',
+ 'pass' => 'password',
+ 'host' => 'repo.frontaccounting.eu', // repo server address
+ 'branch' => '2.4' // Repository branch for current sources version
);