本文整理汇总了PHP中get_company_prefs函数的典型用法代码示例。如果您正苦于以下问题:PHP get_company_prefs函数的具体用法?PHP get_company_prefs怎么用?PHP get_company_prefs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_company_prefs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install
function install($pref, $force)
{
global $db, $systypes_array;
if (!$this->preconf) {
return false;
}
// Until 2.2 sanitizing text input with db_escape was not
// consequent enough. To avoid comparision problems we have to
// fix this now.
sanitize_database($pref);
if ($this->beta) {
// nothing more to be done on upgrade from 2.2beta
return true;
}
// set item category dflt accounts to values from company GL setup
$prefs = get_company_prefs();
$sql = "UPDATE {$pref}stock_category SET " . "dflt_sales_act = '" . $prefs['default_inv_sales_act'] . "'," . "dflt_cogs_act = '" . $prefs['default_cogs_act'] . "'," . "dflt_inventory_act = '" . $prefs['default_inventory_act'] . "'," . "dflt_adjustment_act = '" . $prefs['default_adj_act'] . "'," . "dflt_assembly_act = '" . $prefs['default_assembly_act'] . "'";
if (db_query($sql) == false) {
display_error("Cannot update category default GL accounts" . ':<br>' . db_error_msg($db));
return false;
}
// add all references to refs table for easy searching via journal interface
foreach ($systypes_array as $typeno => $typename) {
$info = get_systype_db_info($typeno);
if ($info == null || $info[3] == null) {
continue;
}
$tbl = str_replace(TB_PREF, $pref, $info[0]);
$sql = "SELECT DISTINCT {$info[2]} as id,{$info[3]} as ref FROM {$tbl}";
if ($info[1]) {
$sql .= " WHERE {$info[1]}={$typeno}";
}
$result = db_query($sql);
if (db_num_rows($result)) {
while ($row = db_fetch($result)) {
$res2 = db_query("INSERT INTO {$pref}refs VALUES(" . $row['id'] . "," . $typeno . ",'" . $row['ref'] . "')");
if (!$res2) {
display_error(_("Cannot copy references from {$tbl}") . ':<br>' . db_error_msg($db));
return false;
}
}
}
}
if (!($ret = db_query("SELECT MAX(`order_no`) FROM `{$pref}sales_orders`")) || !db_num_rows($ret)) {
display_error(_('Cannot query max sales order number.'));
return false;
}
$row = db_fetch($ret);
$max_order = $row[0];
$next_ref = $max_order + 1;
$sql = "UPDATE `{$pref}sys_types` \n\t\t\tSET `type_no`='{$max_order}',`next_reference`='{$next_ref}'\n\t\t\tWHERE `type_id`=30";
if (!db_query($sql)) {
display_error(_('Cannot store next sales order reference.'));
return false;
}
return convert_roles($pref);
}
示例2: print_inventory_sales
function print_inventory_sales()
{
global $path_to_root;
$from = $_POST['PARAM_0'];
$destination = $_POST['PARAM_1'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$dec = user_price_dec();
if ($category == ALL_NUMERIC) {
$category = 0;
}
if ($category == 0) {
$cat = _('All');
} else {
$cat = get_category_name($category);
}
$cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
$headers = array(_('Date'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date'), _('CM#'), _('Returns'), _(''), _('Discount'), _('Balance'), _('Date'), _('PR/OR#'), _('Date'), _('OR #'), _('Amount'), _('Partial'), _('Balance'), _('Date'), _(''), _('Commission'), _('w/tax'), _('Net Commission'));
$header2 = array(_(''), '', '', _('Invoice'), _('Amount'), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), '', _(''), _(''));
$aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
$rep = new FrontReport(_('Series Report'), "SeriesReport", user_pagesize(), 8, 'L');
$rep->Font();
$rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
$rep->NewPage();
$total = $grandtotal = 0.0;
$total1 = $grandtotal1 = 0.0;
$total2 = $grandtotal2 = 0.0;
$catt = '';
$res = getTransactions($imc, $from);
while ($myrow = db_fetch($res)) {
$company_data = get_company_prefs();
$branch = get_branch($myrow["branch_code"]);
$branch_data = get_branch_accounts($myrow['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
$salesman = get_imc_code($myrow['branch_code']);
$res2 = get_return_details($myrow['order_']);
$returns = 0;
$rtn_dt = 0;
$credit_num = "";
$cm_date = "";
$num = db_num_rows($res2);
$var = array();
while ($myrow2 = db_fetch($res2)) {
$returns += $myrow2['ov_amount'];
if ($num > 1) {
$credit_num .= $myrow2['customized_no'] . "/";
$cm_date = $myrow2['tran_date'] . "/";
} else {
$credit_num .= $myrow2['customized_no'];
$cm_date = $myrow2['tran_date'];
}
$var = array($myrow2['trans_no']);
//$res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
// while ($myrow3 = db_fetch($res2)){
// $rtn_dt += abs($myrow3['amount']);
// }
}
foreach ($var as $vars) {
$res2 = get_return_discount($branch_data['sales_discount_account'], ST_CUSTCREDIT, $vars);
while ($myrow3 = db_fetch($res2)) {
$rtn_dt += abs($myrow3['amount']);
}
}
$total_returns = $returns + $rtn_dt;
$return_discount = $rtn_dt / $total_returns * 100;
//$discount = $myrow['discount'];
$invoicetot = $myrow['ov_amount'] + $dt;
$invoice_discount = $dt / $invoicetot * 100;
$sales_discount = ($invoicetot - $total_returns) * ($invoice_discount / 100);
$net_sales = $invoicetot - $total_returns - $sales_discount;
$gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
$tot_invoice = $invoicetot - $invoicetot * ($invoice_discount / 100);
$sample = $invoicetot - $total_returns;
$rep->TextCol(0, 1, $myrow['tranDate']);
$rep->TextCol(1, 2, $myrow['br_name']);
$rep->TextCol(2, 3, $salesman);
$rep->TextCol(3, 4, $myrow['customized_no']);
if ($myrow['IsVoid'] == '') {
$rep->AmountCol(4, 5, $invoicetot, 2);
$rep->TextCol(5, 6, $cm_date);
$rep->TextCol(6, 7, $credit_num);
if ($total_returns != 0) {
$rep->AmountCol(7, 8, $total_returns, 2);
}
if ($invoice_discount < 0) {
$rep->TextCol(8, 9, "CLIENT SALES/SALES DISCOUNT NOT DEFINED.");
} else {
$rep->TextCol(8, 9, $invoice_discount . "%");
}
if ($sales_discount < 0) {
$rep->TextCol(9, 10, "ERROR.");
} else {
if ($sales_discount != 0) {
$rep->AmountCol(9, 10, $sales_discount, 2);
}
}
//.........这里部分代码省略.........
示例3: hidden
$_POST['adjustment_account'] = $myrow["dflt_adjustment_act"];
$_POST['assembly_account'] = $myrow["dflt_assembly_act"];
$_POST['units'] = $myrow["dflt_units"];
$_POST['mb_flag'] = $myrow["dflt_mb_flag"];
$_POST['dim1'] = $myrow["dflt_dim1"];
$_POST['dim2'] = $myrow["dflt_dim2"];
$_POST['no_sale'] = $myrow["dflt_no_sale"];
}
hidden('selected_id', $selected_id);
hidden('category_id');
} else {
if ($Mode != 'CLONE') {
$_POST['long_description'] = '';
$_POST['description'] = '';
$_POST['no_sale'] = 0;
$company_record = get_company_prefs();
if (get_post('inventory_account') == "") {
$_POST['inventory_account'] = $company_record["default_inventory_act"];
}
if (get_post('cogs_account') == "") {
$_POST['cogs_account'] = $company_record["default_cogs_act"];
}
if (get_post('sales_account') == "") {
$_POST['sales_account'] = $company_record["default_inv_sales_act"];
}
if (get_post('adjustment_account') == "") {
$_POST['adjustment_account'] = $company_record["default_adj_act"];
}
if (get_post('assembly_account') == "") {
$_POST['assembly_account'] = $company_record["default_assembly_act"];
}
示例4: print_inventory_sales
function print_inventory_sales()
{
global $path_to_root;
$from = $_POST['PARAM_0'];
$destination = $_POST['PARAM_1'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$dec = user_price_dec();
if ($category == ALL_NUMERIC) {
$category = 0;
}
if ($category == 0) {
$cat = _('All');
} else {
$cat = get_category_name($category);
}
$cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
$headers = array(_('Date'), _('Client Name'), _('IMC'), _('Charge'), _('Sales'), _('Date'), _('CM#'), _('Returns'), _(''), _('Discount'), _('Balance'), _('Date'), _('PR/OR#'), _('Date'), _('OR #'), _('Partial'), _('Net'), _('Balance'), _('Date'), _(''), _('Commission'), _('w/tax'), _('Net Commission'));
$header2 = array(_(''), '', '', _('Invoice'), _('Amount'), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), _(''), '', _(''), _(''));
$aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
$rep = new FrontReport(_('Series Report'), "Series Report", user_pagesize(), 8, 'L');
$rep->Font();
$rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
$rep->NewPage();
$total = $grandtotal = 0.0;
$total1 = $grandtotal1 = 0.0;
$total2 = $grandtotal2 = 0.0;
$catt = '';
$res = getTransactions($imc, $from);
while ($myrow = db_fetch($res)) {
$company_data = get_company_prefs();
$branch = get_branch($myrow["branch_code"]);
$branch_data = get_branch_accounts($myrow['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
$salesman = get_imc_code($myrow['branch_code']);
$res2 = get_return_details($myrow['order_']);
$returns = 0;
$rtn_dt = 0;
while ($myrow2 = db_fetch($res2)) {
$returns += $myrow2['ov_amount'];
$credit_num = $myrow2['customized_no'];
$cm_date = $myrow2['tran_date'];
$res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
while ($myrow3 = db_fetch($res2)) {
$rtn_dt += abs($myrow3['amount']);
}
}
$total_returns = $returns + $rtn_dt;
$return_discount = $rtn_dt / $total_returns * 100;
$discount = $myrow['discount'];
$invoicetot = $myrow['ov_amount'] + $dt;
$sales_discount = ($invoicetot - $total_returns) * ($return_discount / 100);
$net_sales = $invoicetot - $total_returns - $sales_discount;
$gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
$rep->TextCol(0, 1, $myrow['tran_date']);
$rep->TextCol(1, 2, $myrow['br_name']);
$rep->TextCol(2, 3, $salesman);
$rep->TextCol(3, 4, $myrow['customized_no']);
$rep->AmountCol(4, 5, $invoicetot, 2);
$rep->TextCol(5, 6, $cm_date);
$rep->TextCol(6, 7, $credit_num);
$rep->AmountCol(7, 8, $total_returns, 2);
$rep->TextCol(8, 9, $return_discount . "%");
$rep->AmountCol(9, 10, $sales_discount, 2);
$rep->AmountCol(10, 11, $net_sales, 2);
$rep->TextCol(18, 19, $myrow['date']);
$rep->TextCol(19, 20, $myrow['commission'] . "%");
$rep->AmountCol(20, 21, $gross_commission, 2);
$rep->AmountCol(21, 22, $myrow['with_tax'], 2);
$rep->AmountCol(22, 23, $myrow['net_commission'], 2);
$or = get_pr_details($myrow['type'], $myrow['trans_no']);
while ($pr = db_fetch($or)) {
$net_remittance = $net_sales - $pr['amt'];
$rep->TextCol(11, 12, $pr['date_alloc']);
$rep->TextCol(12, 13, $pr['customized_no']);
$rep->TextCol(13, 14, _("DATE"));
$rep->TextCol(14, 15, _("OR#"));
$rep->TextCol(15, 16, "");
$rep->AmountCol(17, 18, '', 2);
}
$rep->NewLine();
//
}
$rep->NewLine();
$rep->End();
}
示例5: update_company_prefs
//-------------------------------------------------------------------------------------------------
if (isset($_POST['submit']) && can_process()) {
update_company_prefs(get_post(array('retained_earnings_act', 'profit_loss_year_act', 'debtors_act', 'pyt_discount_act', 'creditors_act', 'freight_act', 'exchange_diff_act', 'bank_charge_act', 'default_sales_act', 'default_sales_discount_act', 'default_prompt_payment_act', 'default_inventory_act', 'default_cogs_act', 'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text', 'past_due_days', 'default_workorder_required', 'default_dim_required', 'default_delivery_required', 'grn_clearing_act', 'allow_negative_stock' => 0, 'accumulate_shipping' => 0, 'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit' => 0.0)));
display_notification(_("The general GL setup has been updated."));
}
/* end of if submit */
//-------------------------------------------------------------------------------------------------
start_form();
start_outer_table(TABLESTYLE2);
table_section(1);
if (get_company_pref('grn_clearing_act') === null) {
// available from 2.3.1, can be not defined on pre-2.4 installations
set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
refresh_sys_prefs();
}
$myrow = get_company_prefs();
$_POST['retained_earnings_act'] = $myrow["retained_earnings_act"];
$_POST['profit_loss_year_act'] = $myrow["profit_loss_year_act"];
$_POST['debtors_act'] = $myrow["debtors_act"];
$_POST['creditors_act'] = $myrow["creditors_act"];
$_POST['freight_act'] = $myrow["freight_act"];
$_POST['pyt_discount_act'] = $myrow["pyt_discount_act"];
$_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
$_POST['bank_charge_act'] = $myrow["bank_charge_act"];
$_POST['default_sales_act'] = $myrow["default_sales_act"];
$_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
$_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
$_POST['default_inventory_act'] = $myrow["default_inventory_act"];
$_POST['default_cogs_act'] = $myrow["default_cogs_act"];
$_POST['default_adj_act'] = $myrow["default_adj_act"];
$_POST['default_inv_sales_act'] = $myrow['default_inv_sales_act'];
示例6: print_invoices
function print_invoices()
{
global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount;
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$email = $_POST['PARAM_3'];
$pay_service = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$customer = $_POST['PARAM_6'];
$orientation = $_POST['PARAM_7'];
if (!$from || !$to) {
return;
}
$orientation = $orientation ? 'L' : 'P';
$dec = user_price_dec();
$fno = explode("-", $from);
$tno = explode("-", $to);
$from = min($fno[0], $tno[0]);
$to = max($fno[0], $tno[0]);
$cols = array(4, 40, 60, 100, 200, 250, 300, 320, 400, 450, 500);
// $headers in doctext.inc
$aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
//$params = array('comments' => $comments);
$cur = get_company_Pref('curr_default');
$company_data = get_company_prefs();
if ($email == 0) {
$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
}
if ($orientation == 'L') {
recalculate_cols($cols);
}
for ($i = $from; $i <= $to; $i++) {
if (!exists_customer_trans(ST_SALESINVOICE, $i)) {
continue;
}
$sign = 1;
$myrow = get_customer_trans($i, ST_SALESINVOICE);
if ($customer && $myrow['debtor_no'] != $customer) {
continue;
}
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
$sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
if ($email == 1) {
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
//$rep->title = _('INVOICE');
$rep->filename = "Invoice" . $myrow['reference'] . ".pdf";
}
$rep->SetHeaderType(0);
$rep->currency = $cur;
$rep->Font();
$rep->Info(null, $cols, null, $aligns);
//$contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true);
//$baccount['payment_service'] = $pay_service;
$salesman = get_imc_code($branch['branch_code']);
$pay_term = get_payment_terms($myrow['payment_terms']);
$branch_data = get_branch_accounts($myrow['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
$invoice_no = get_custom_no($myrow['trans_no'], $myrow['type']);
$contact = getContactPerson($myrow['salesman'], $myrow['debtor_no'], $branch['branch_code']);
$rep->NewPage();
$result = get_customer_trans_details(ST_SALESINVOICE, $i);
$SubTotal = 0;
$rep->NewLine(8);
$rep->TextCol(2, 7, _("CHARGE INVOICE # " . $invoice_no));
$rep->TextCol(8, 9, $myrow['TranDate']);
$rep->NewLine();
$rep->TextCol(2, 7, $branch['br_name']);
if ($dt != 0) {
//$display_bulk_discount = (($sub_total - $myrow['Total']) / $sub_total) * 100;
$tot = $myrow['Total'] + $dt;
$dscnt = ($tot - $myrow['Total']) / $tot * 100;
//$dscnt = ($dt / $myrow['Total']) * 100;
$significant = strlen(substr(strrchr($dscnt, "."), 1));
if ($significant > 2) {
$rep->TextCol(7, 9, floor($dscnt) . "%");
} else {
$rep->TextCol(7, 9, $dscnt . "%");
}
}
$rep->NewLine();
$rep->TextCol(2, 7, $branch['branch_ref']);
$rep->TextCol(8, 9, $salesman);
$rep->NewLine();
$rep->TextCol(2, 6, $contact);
if ($pay_term['terms'] == 'Cash Only') {
$rep->TextCol(8, 9, $pay_term['terms']);
} else {
$rep->TextCol(7, 10, $pay_term['terms']);
}
$rep->NewLine();
$oldrow = $rep->row;
$newrow = $rep->row;
$rep->TextColLines(2, 6, $branch['br_address'], -2);
$rep->row = $oldrow;
$rep->NewLine(5);
$rep->Font('bold');
//.........这里部分代码省略.........
示例7: supplier_settings
function supplier_settings(&$supplier_id)
{
start_outer_table(TABLESTYLE2);
table_section(1);
if ($supplier_id) {
//SupplierID exists - either passed when calling the form or from the form itself
$myrow = get_supplier($_POST['supplier_id']);
$_POST['supp_name'] = $myrow["supp_name"];
$_POST['supp_ref'] = $myrow["supp_ref"];
$_POST['address'] = $myrow["address"];
$_POST['supp_address'] = $myrow["supp_address"];
$_POST['gst_no'] = $myrow["gst_no"];
$_POST['website'] = $myrow["website"];
$_POST['supp_account_no'] = $myrow["supp_account_no"];
$_POST['bank_account'] = $myrow["bank_account"];
$_POST['dimension_id'] = $myrow["dimension_id"];
$_POST['dimension2_id'] = $myrow["dimension2_id"];
$_POST['curr_code'] = $myrow["curr_code"];
$_POST['payment_terms'] = $myrow["payment_terms"];
$_POST['credit_limit'] = price_format($myrow["credit_limit"]);
$_POST['tax_group_id'] = $myrow["tax_group_id"];
$_POST['tax_included'] = $myrow["tax_included"];
$_POST['payable_account'] = $myrow["payable_account"];
$_POST['purchase_account'] = $myrow["purchase_account"];
$_POST['payment_discount_account'] = $myrow["payment_discount_account"];
$_POST['notes'] = $myrow["notes"];
$_POST['inactive'] = $myrow["inactive"];
} else {
$_POST['supp_name'] = $_POST['supp_ref'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = '';
$_POST['dimension_id'] = 0;
$_POST['dimension2_id'] = 0;
$_POST['tax_included'] = 0;
$_POST['sales_type'] = -1;
$_POST['gst_no'] = $_POST['bank_account'] = '';
$_POST['payment_terms'] = '';
$_POST['credit_limit'] = price_format(0);
$company_record = get_company_prefs();
$_POST['curr_code'] = $company_record["curr_default"];
$_POST['payable_account'] = $company_record["creditors_act"];
$_POST['purchase_account'] = '';
// default/item's cogs account
$_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
}
table_section_title(_("Basic Data"));
text_row(_("Supplier Name:"), 'supp_name', null, 42, 40);
text_row(_("Supplier Short Name:"), 'supp_ref', null, 30, 30);
text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
link_row(_("Website:"), 'website', null, 35, 55);
if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') || key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) {
label_row(_("Supplier's Currency:"), $_POST['curr_code']);
hidden('curr_code', $_POST['curr_code']);
} else {
currencies_list_row(_("Supplier's Currency:"), 'curr_code', null);
}
tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
text_row(_("Our Customer No:"), 'supp_account_no', null, 42, 40);
table_section_title(_("Purchasing"));
text_row(_("Bank Name/Account:"), 'bank_account', null, 42, 40);
amount_row(_("Credit Limit:"), 'credit_limit', null);
payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
//
// tax_included option from supplier record is used directly in update_average_cost() function,
// therefore we can't edit the option after any transaction waas done for the supplier.
//
if (is_new_supplier($supplier_id)) {
check_row(_("Prices contain tax included:"), 'tax_included');
} else {
hidden('tax_included');
label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
}
table_section_title(_("Accounts"));
gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'], false, false, _("Use Item Inventory/COGS Account"));
gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
if (!$supplier_id) {
table_section_title(_("Contact Data"));
text_row(_("Phone Number:"), 'phone', null, 32, 30);
text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
}
table_section(2);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
table_section_title(_("Dimension"));
dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
if ($dim > 1) {
dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
}
}
if ($dim < 1) {
hidden('dimension_id', 0);
}
if ($dim < 2) {
hidden('dimension2_id', 0);
}
table_section_title(_("Addresses"));
textarea_row(_("Mailing Address:"), 'address', null, 35, 5);
textarea_row(_("Physical Address:"), 'supp_address', null, 35, 5);
table_section_title(_("General"));
textarea_row(_("General Notes:"), 'notes', null, 35, 5);
if ($supplier_id) {
//.........这里部分代码省略.........
示例8: print_statements
function print_statements()
{
global $path_to_root, $systypes_array;
include_once $path_to_root . "/reporting/includes/pdf_report2.inc";
$from = date2sql($_POST['PARAM_0']);
$to = date2sql($_POST['PARAM_1']);
$customer = $_POST['PARAM_2'];
$currency = $_POST['PARAM_3'];
$email = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$orientation = $_POST['PARAM_6'];
$orientation = $orientation ? 'L' : 'P';
$dec = 2;
$cols = array(4, 64, 180, 250, 300, 350, 400, 480);
//$headers in doctext.inc
$aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right', 'right');
$params = array('comments' => $comments);
$cur = get_company_pref('curr_default');
$PastDueDays1 = get_company_pref('past_due_days');
$PastDueDays2 = 2 * $PastDueDays1;
if ($email == 0) {
$rep = new FrontReport(_('CUSTOMER ACCOUNT STATEMENT'), "StatementBulk", user_pagesize(), 9, $orientation);
}
if ($orientation == 'L') {
recalculate_cols($cols);
}
$sql = "SELECT b.debtor_no, b.name AS DebtorName, b.address, b.tax_id, b.curr_code, cust.salesman, \n\tcurdate() AS tran_date, CONCAT (d.name, d.name2) AS contactPerson, d.phone, d.phone2 \n\tFROM " . TB_PREF . "debtors_master b INNER JOIN\n" . TB_PREF . "crm_contacts c on b.debtor_no=c.entity_id INNER JOIN " . TB_PREF . "crm_persons d on c.person_id=d.id\nINNER JOIN " . TB_PREF . "cust_branch cust on b.debtor_no=cust.debtor_no";
if ($customer != ALL_TEXT) {
$sql .= " WHERE c.type='customer' and cust.salesman = " . db_escape($customer);
} else {
$sql .= " where c.type='customer' and cust.salesman = " . db_escape($customer) . " ORDER by b.name";
}
$result = db_query($sql, "The customers could not be retrieved");
while ($debtor_row = db_fetch($result)) {
$date = date('Y-m-d');
if ($from != $to) {
// find the latest point where the balance was null
$start = findLatestNullDate($debtor_row['debtor_no'], $from);
// but not earlier than the $to date.
if (date1_greater_date2(sql2date($start), sql2date($to))) {
$start = $to;
}
if (date1_greater_date2(sql2date($from), sql2date($start))) {
$start = $from;
}
} else {
$start = $from;
}
$debtor_row['order_'] = "";
$TransResult = getTransactions($debtor_row['debtor_no'], $start, $date);
$baccount = get_default_bank_account($debtor_row['curr_code']);
$params['bankaccount'] = $baccount['id'];
if (db_num_rows($TransResult) == 0) {
continue;
}
if ($email == 1) {
$rep = new FrontReport("CUSTOMER ACCOUNT STATEMENT", "", user_pagesize(), 9, $orientation);
$rep->title = _('STATEMENT OF ACCOUNT');
$rep->filename = "Statement" . $debtor_row['debtor_no'] . ".pdf";
$rep->Info($params, $cols, null, $aligns);
}
$rep->filename = "ST-" . strtr($debtor_row['DebtorName'], " '", "__") . "--" . strtr(Today(), "/", "-") . ".pdf";
$contacts = get_customer_contacts($debtor_row['debtor_no'], 'invoice');
$rep->SetHeaderType('customheader');
$rep->currency = $cur;
$rep->Font();
$rep->Info(null, $cols, null, $aligns);
$rep->SetCommonData($debtor_row, null, null, $baccount, ST_STATEMENT, $contacts);
$rep->NewPage();
$doctype = ST_STATEMENT;
//$rep->TextCol(0,4,"yeah");
$current = false;
$balance = getInitialBalance($debtor_row['debtor_no'], $start);
if (true || Abs($balance) > 1.0E-6) {
if (Abs($balance) < 1.0E-6) {
$rep->SetTextColor(190, 190, 190);
} else {
if ($balance > 0) {
$rep->SetTextColor(190, 0, 0);
}
}
$rep->SetTextColor(0, 0, 0);
}
$overdue = 0;
$prev = '';
$gross_amount = 0;
$gross_amount2 = 0;
$payment_tot = 0;
$tots = 0;
$discount_amount = 0;
$percent = 0;
while ($transaction_row = db_fetch($TransResult)) {
if ($myrow['IsVoid'] == '') {
$company_data = get_company_prefs();
$branch = get_branch($transaction_row["branch_code"]);
$branch_data = get_branch_accounts($transaction_row['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $transaction_row['type'], $transaction_row['trans_no']);
$DisplayTotal = number_format2(Abs($transaction_row["TotalAmount"] + $dt), $dec);
$DisplayAlloc = number_format2($transaction_row["Allocated"], $dec);
$DisplayNet = number_format2($transaction_row["TotalAmount"] - $transaction_row["Allocated"], $dec);
//.........这里部分代码省略.........
示例9: print_check
function print_check()
{
global $path_to_root, $systypes_array, $print_invoice_no;
// Get the payment
$from = $_POST['PARAM_0'];
$destination = $_POST['PARAM_1'];
$trans_no = explode("-", $from);
$dec = user_price_dec();
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$from_trans = get_remittance($trans_no[1], $trans_no[0]);
// Get check information
$total_amt = $from_trans['Total'];
$date = sql2date($from_trans['tran_date']);
$memo = get_comments_string($trans_no[1], $trans_no[0]);
// Begin the report
$rep = new FrontReport(_('Printable Check'), "PrintableCheck", user_pagesize());
$rep->SetHeaderType(null);
$rep->NewPage();
// Set the font
$rep->Font('', 'courier');
$rep->fontSize = 12;
//////////////////
// Check portion
$rep->NewLine(1, 0, 76);
$rep->cols = array(63, 340, 470, 565);
$rep->aligns = array('left', 'left', 'right', 'right');
// Pay to
$rep->TextCol(0, 1, $from_trans['supp_name']);
// Date
$rep->DateCol(1, 2, $rep->DatePrettyPrint($date, 0, 0));
// Amount (numeric)
$rep->TextCol(2, 3, '***' . number_format2(-$total_amt, $dec));
// Amount (words)
$rep->NewLine(1, 0, 23);
$rep->TextCol(0, 2, $from_trans['curr_code'] . ": " . price_in_words(-$total_amt, ST_CHEQUE));
// Memo
$rep->NewLine(1, 0, 78);
$rep->TextCol(0, 1, $memo);
$rep->company = get_company_prefs();
/////////////////////
// Item details x 2
for ($section = 1; $section <= 2; $section++) {
$rep->fontSize = 12;
// Move down to the correct section
$rep->row = $section == 1 ? 505 : 255;
$rep->cols = array(20, 340, 470, 588);
$rep->aligns = array('left', 'left', 'right', 'right');
// Pay to
$rep->Font('b');
$rep->TextCol(0, 1, $from_trans['supp_name']);
$rep->Font();
// Date
$rep->DateCol(1, 2, $rep->DatePrettyPrint($date, 0, 0));
// Amount (numeric)
$rep->TextCol(2, 3, number_format2(-$total_amt, 2));
// Add Trans # + Reference
$rep->NewLine();
if ($print_invoice_no == 0) {
$tno = $from_trans['reference'];
} else {
$tno = $from_trans['trans_no'];
}
$rep->TextCol(0, 3, sprintf(_("Payment # %s - from Customer: %s - %s"), $tno, $from_trans['supp_account_no'], $rep->company['coy_name']));
// Add memo
$rep->NewLine();
$rep->TextCol(0, 3, _("Memo: ") . $memo);
// TODO: Do we want to set a limit on # of item details? (Max is probably 6-7)
// Get item details
$result = get_allocations_for_remittance($from_trans['supplier_id'], $from_trans['type'], $from_trans['trans_no']);
// Fill in details
$rep->NewLine(2);
$rep->fontSize = 10;
// Use different columns now for the additional info
$rep->cols = array(20, 160, 235, 290, 370, 480, 588);
$rep->aligns = array('left', 'left', 'left', 'right', 'right', 'right');
// Add headers
$rep->Font('b');
$rep->TextCol(0, 1, _("Type/Id"));
$rep->TextCol(1, 2, _("Trans Date"));
$rep->TextCol(2, 3, _("Due Date"));
$rep->TextCol(3, 4, _("Total Amount"));
$rep->TextCol(4, 5, _("Left to Allocate"));
$rep->TextCol(5, 6, _("This Allocation"));
$rep->NewLine();
$rep->Font();
$total_allocated = 0;
while ($item = db_fetch($result)) {
$rep->TextCol(0, 1, $systypes_array[$item['type']] . " " . $item['supp_reference']);
$rep->TextCol(1, 2, sql2date($item['tran_date']));
$rep->TextCol(2, 3, sql2date($item['due_date']));
$rep->AmountCol(3, 4, $item['Total'], $dec);
$rep->AmountCol(4, 5, $item['Total'] - $item['alloc'], $dec);
$rep->AmountCol(5, 6, $item['amt'], $dec);
$total_allocated += $item['amt'];
$rep->NewLine(1, 0, $rep->lineHeight + 3);
// Space it out
//.........这里部分代码省略.........
示例10: print_summary
function print_summary()
{
global $path_to_root;
$sman = $_POST['PARAM_0'];
$from = $_POST['PARAM_1'];
$to = $_POST['PARAM_2'];
$stat = $_POST['PARAM_3'];
$orientation = $_POST['PARAM_4'];
$destination = $_POST['PARAM_5'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$orientation = $orientation ? 'L' : 'P';
$dec = user_price_dec();
$cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 520, 550);
$headers = array(_('IMC'), _('Gross'), _('Returns'), _('% To Sales'), _('Net Sales'), _('Full Payment'), _('% To Sales'), _('Partial Payments'), _('% To Sales'), _('Accounts Receivables'), _('% To Sales'));
$aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
$aligns2 = $aligns;
$summary = 1;
$rep = new FrontReport(_('Sales Status'), "Sales Status", user_pagesize(), 9, $orientation);
if ($orientation == 'L') {
recalculate_cols($cols);
}
$cols2 = $cols;
$rep->Font();
$rep->Info(null, $cols, $headers, $aligns);
$rep->NewPage();
$total = $grandtotal = 0.0;
$total1 = $grandtotal1 = 0.0;
$total2 = $grandtotal2 = 0.0;
$catt = '';
$slist = array();
if ($sman == "") {
$row = get_all_salesman();
while ($r = db_fetch($row)) {
array_push($slist, $r['salesman_code']);
}
foreach ($slist as $slists) {
$res = getTransactions($from, $to, $slists, $stat);
}
} else {
$res = getTransactions($from, $to, $sman, $stat);
}
$prev = '';
while ($myrow = db_fetch($res)) {
$current = $myrow['salesman_code'];
if ($myrow['salesman_code'] != "") {
if ($current == $prev) {
} else {
}
$prev = $current;
}
$company_data = get_company_prefs();
$branch = get_branch($myrow["branch_code"]);
$branch_data = get_branch_accounts($myrow['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
$salesman = get_imc_code($myrow['branch_code']);
$res2 = get_return_details($myrow['order_']);
$returns = 0;
$rtn_dt = 0;
$credit_num = "";
$cm_date = "";
$num = db_num_rows($res2);
$var = array();
while ($myrow2 = db_fetch($res2)) {
$returns += $myrow2['ov_amount'];
if ($num > 1) {
$credit_num .= $myrow2['customized_no'] . "/";
$cm_date = $myrow2['tran_date'] . "/";
} else {
$credit_num .= $myrow2['customized_no'];
$cm_date = $myrow2['tran_date'];
}
$var = array($myrow2['trans_no']);
}
foreach ($var as $vars) {
$res2 = get_return_discount($branch_data['sales_discount_account'], ST_CUSTCREDIT, $vars);
while ($myrow3 = db_fetch($res2)) {
$rtn_dt += abs($myrow3['amount']);
}
}
$total_returns = $returns + $rtn_dt;
$return_discount = $rtn_dt / $total_returns * 100;
$invoicetot = $myrow['ov_amount'] + $dt;
$invoice_discount = $dt / $invoicetot * 100;
$sales_discount = ($invoicetot - $total_returns) * ($invoice_discount / 100);
$net_sales = $invoicetot - $total_returns - $sales_discount;
$gross_commission = ($invoicetot - $total_returns) * ($myrow['commission'] / 100);
$tot_invoice = $invoicetot - $invoicetot * ($invoice_discount / 100);
if ($myrow['IsVoid'] == '') {
$myrow4 = db_fetch(get_commission_details($myrow['type'], $myrow['trans_no']));
$comm = ($invoicetot - $total_returns) * ($myrow4['commission'] / 100);
$partial_payment = 0;
$zero;
$or = get_pr_details($myrow['type'], $myrow['trans_no']);
$ref = '';
$num2 = db_num_rows($or);
$date_alloc = '';
//.........这里部分代码省略.........
示例11: print_invoices
function print_invoices()
{
global $path_to_root, $alternative_tax_include_on_docs, $suppress_tax_rates, $no_zero_lines_amount;
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$email = $_POST['PARAM_3'];
$pay_service = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
$customer = $_POST['PARAM_6'];
$orientation = $_POST['PARAM_7'];
if (!$from || !$to) {
return;
}
$orientation = $orientation ? 'L' : 'P';
$dec = user_price_dec();
$fno = explode("-", $from);
$tno = explode("-", $to);
$from = min($fno[0], $tno[0]);
$to = max($fno[0], $tno[0]);
$cols = array(-18, 40, 60, 100, 160, 200, 260, 360, 420, 450, 500);
// $headers in doctext.inc
$aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
//$params = array('comments' => $comments);
$cur = get_company_Pref('curr_default');
$company_data = get_company_prefs();
if ($email == 0) {
$rep = new FrontReport(_('INVOICE'), "InvoiceBulk", user_pagesize(), 9, $orientation);
}
if ($orientation == 'L') {
recalculate_cols($cols);
}
for ($i = $from; $i <= $to; $i++) {
if (!exists_customer_trans(ST_SALESINVOICE, $i)) {
continue;
}
$sign = 1;
$myrow = get_customer_trans($i, ST_SALESINVOICE);
if ($customer && $myrow['debtor_no'] != $customer) {
continue;
}
$baccount = get_default_bank_account($myrow['curr_code']);
$params['bankaccount'] = $baccount['id'];
$branch = get_branch($myrow["branch_code"]);
$sales_order = get_sales_order_header($myrow["order_"], ST_SALESORDER);
if ($email == 1) {
$rep = new FrontReport("", "", user_pagesize(), 9, $orientation);
//$rep->title = _('INVOICE');
$rep->filename = "Invoice" . $myrow['reference'] . ".pdf";
}
$rep->SetHeaderType(0);
$rep->currency = $cur;
$rep->Font();
$rep->Info(null, $cols, null, $aligns);
$salesman = get_imc_code($branch['branch_code']);
$pay_term = get_payment_terms($myrow['payment_terms']);
$branch_data = get_branch_accounts($myrow['branch_code']);
$invoice_no = get_custom_no($myrow['trans_no'], $myrow['type']);
$contact = getContact($myrow['salesman'], $myrow['debtor_no'], $branch['branch_code']);
$cnumber = getContactNumber($myrow['salesman'], $myrow['debtor_no'], $branch['branch_code']);
$rep->NewPage();
$result = get_customer_trans_details(ST_SALESINVOICE, $i);
$SubTotal = 0;
$rep->NewLine(6);
$rep->TextCol(2, 7, $invoice_no);
$rep->TextCol(6, 8, $myrow['TranDate']);
$rep->NewLine();
$rep->TextCol(2, 7, $branch['br_name']);
$rep->TextCol(7, 8, $myrow['bulk_discount'] . "%");
$rep->NewLine();
$rep->TextCol(2, 7, $branch['branch_ref']);
$rep->TextCol(6, 8, $salesman);
$rep->NewLine();
$rep->TextCol(2, 6, $contact . " - " . $cnumber);
if ($pay_term['terms'] == 'C.O.D.' || $pay_term['Cash Only']) {
$rep->TextCol(7, 8, $pay_term['terms'], -2);
} else {
$oldrow = $rep->row;
$newrow = $rep->row;
$rep->TextColLines(7, 9, $pay_term['terms'], -2);
$newrow = $rep->row;
$rep->row = $oldrow;
}
$rep->NewLine();
$oldrow = $rep->row;
$newrow = $rep->row;
$rep->TextColLines(2, 6, $branch['br_address'], -2);
$rep->row = $oldrow;
$rep->NewLine(4);
$rep->Font();
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());
$Net2 = round2($sign * ($myrow2["unit_price"] * $myrow2["quantity"]), user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"], 2);
$DisplayQty = number_format2($sign * $myrow2["quantity"], get_qty_dec($myrow2['stock_id']));
//.........这里部分代码省略.........
示例12: print_summary
function print_summary()
{
global $path_to_root;
$imc = $_POST['PARAM_0'];
$from = $_POST['PARAM_1'];
$to = $_POST['PARAM_2'];
$status = $_POST['PARAM_3'];
$orientation = $_POST['PARAM_4'];
$destination = $_POST['PARAM_5'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$orientation = $orientation ? 'L' : 'P';
$dec = user_price_dec();
$cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 520, 550);
$headers = array(_('IMC'), _('Gross'), _('Returns'), _('Discount'), _('% To Sales'), _('Net Sales'), _('Full Payment'), _('% To Sales'), _('Partial Payments'), _('% To Sales'), _('Accounts Receivables'), _('% To Sales'));
$aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
$aligns2 = $aligns;
$summary = 1;
$rep = new FrontReport(_('Sales Status'), "Sales Status", user_pagesize(), 9, $orientation);
if ($orientation == 'L') {
recalculate_cols($cols);
}
$cols2 = $cols;
$rep->Font();
$rep->Info(null, $cols, $headers, $aligns);
$rep->NewPage();
$result = getTransactions($imc, $from, $to, ST_SALESINVOICE, $status);
$InvoiceTotal = 0;
$TotalReturn = 0;
$DiscountTotal = 0;
$NetSales = 0;
$FullAlloc = 0;
$PartialAlloc = 0;
$ReceivablesTotal = 0;
$Percentage1 = 0;
$Percentage2 = 0;
$Percentage3 = 0;
$Percentage4 = 0;
$TotalInvoice = 0;
$TotalReturn_2 = 0;
$TotalSales = 0;
$TotalFullAlloc = 0;
$TotalPartialAlloc = 0;
$TotalReceivables = 0;
$TotalDiscount = 0;
$previous = '';
while ($myrow = db_fetch($result)) {
$company_data = get_company_prefs();
$imc = $myrow['imc_code'];
$imc_code = $myrow['salesman_code'];
$DiscountTotal = getDiscountTotal($imc_code, $from, $to, ST_SALESINVOICE, get_company_pref('default_sales_discount_act'), $status);
$ReturnDiscount = getDiscountTotal($imc_code, $from, $to, ST_CUSTCREDIT, get_company_pref('default_sales_discount_act'), $status);
$InvoiceTotal = $myrow['InvoiceTotal'] + $DiscountTotal;
$TotalDiscount = $ReturnDiscount + $DiscountTotal;
$net_partial = 0;
$net_full_payment = 0;
$TotalReturn = 0;
$Transact = getAllocTransact($from, $to, $imc_code, $status);
while ($row = db_fetch($Transact)) {
$branch = get_branch($row["branch_code"]);
$branch_data = get_branch_accounts($row['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $row['type'], $row['trans_no']);
$res2 = get_return_details($row['order_']);
$returns = 0;
$rtn_dt = 0;
$num = db_num_rows($res2);
$var = array();
while ($myrow2 = db_fetch($res2)) {
$returns += $myrow2['ov_amount'];
$var = array($myrow2['trans_no']);
}
foreach ($var as $vars) {
$res2 = get_return_discount($branch_data['sales_discount_account'], ST_CUSTCREDIT, $vars);
while ($myrow3 = db_fetch($res2)) {
$rtn_dt += abs($myrow3['amount']);
}
}
$total_returns = $returns + $rtn_dt;
$return_discount = $rtn_dt / $total_returns * 100;
$TotalReturn += $total_returns;
$invoicetot = $row['ov_amount'] + $dt;
$invoice_discount = $dt / $invoicetot * 100;
$sales_discount = ($invoicetot - $total_returns) * ($invoice_discount / 100);
$net_sales = $invoicetot - $total_returns - $sales_discount;
if ($row['IsVoid'] == '') {
$partial_payment = 0;
$zero;
$or = get_pr_details($row['type'], $row['trans_no']);
$num2 = db_num_rows($or);
$date_alloc = '';
$ctr = 0;
$bal = 0;
$bal1 = 0;
$bal2 = 0;
$ppayment = 0;
$fpayment = 0;
$all_bal = 0;
//.........这里部分代码省略.........
示例13: display_error
if (empty($_POST['smtp_password']) && $_POST['mail_type'] == 'SMTP') {
$errors++;
display_error(_("The SMTP password must be entered."));
}
return $errors == 0;
}
//-------------------------------------------------------------------------------------------------
if (isset($_POST['submit']) && can_process()) {
update_company_prefs(get_post(array('mail_type', 'smtp_host', 'smtp_port', 'smtp_auth', 'smtp_secure', 'smtp_username', 'smtp_password')));
display_notification(_("The mail sending settings has been updated."));
}
/* end of if submit */
if (list_updated('mail_type')) {
$Ajax->activate('details');
}
$prefs = get_company_prefs();
if (!isset($_POST['mail_type'])) {
$_POST['mail_type'] = $prefs['mail_type'];
}
$_POST['smtp_host'] = $prefs['smtp_host'];
$_POST['smtp_port'] = $prefs['smtp_port'];
$_POST['smtp_secure'] = $prefs['smtp_secure'];
$_POST['smtp_username'] = $prefs['smtp_username'];
$_POST['smtp_password'] = $prefs['smtp_password'];
//-------------------------------------------------------------------------------------------------
start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
$_selector = array_selector('mail_type', $_POST['mail_type'], array('MAIL' => 'PHP\'s mail function', 'SMTP' => 'SMTP server'), array('select_submit' => true));
label_cells(_("Mail type:"), $_selector);
end_row();
示例14: print_cash_sale
function print_cash_sale()
{
global $path_to_root;
$from = $_POST['PARAM_0'];
$destination = $_POST['PARAM_1'];
if ($destination) {
include_once $path_to_root . "/reporting/includes/excel_report.inc";
} else {
include_once $path_to_root . "/reporting/includes/pdf_report.inc";
}
$dec = user_price_dec();
if ($category == ALL_NUMERIC) {
$category = 0;
}
if ($category == 0) {
$cat = _('All');
} else {
$cat = get_category_name($category);
}
$cols = array(0, 50, 250, 350, 400, 450, 500, 550, 600, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
$headers = array(_('DATE'), _('CLIENT NAME'), _('IMC'), _('CASH SALES'), _('INVOICE'), _('CASH'), _('SALES'), _('RETURNS'), _('SALES DISCOUNT'), _('SUNDRIES'), _('DR'), _('CR'));
$header2 = array(_(''), '', _('CODE'), _('INVOICE'), _('AMOUNT'), _('DR'), _('CR'), _(' DR'), _('DR'), _(''), _(''));
$aligns = array('left', 'left', 'center', 'left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
$params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
$rep = new FrontReport(_('Cash Sales Report'), "CashSalesReport", user_pagesize(), 8, 'L');
$rep->Font();
$rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
$rep->NewPage();
$res = getTransactions($from);
while ($myrow = db_fetch($res)) {
$company_data = get_company_prefs();
$branch = get_branch($myrow["branch_code"]);
$branch_data = get_branch_accounts($myrow['branch_code']);
$dt = get_discount($branch_data['sales_discount_account'], $myrow['type'], $myrow['trans_no']);
$sales_acct = get_discount($branch_data['sales_account'], $myrow['type'], $myrow['trans_no']);
$salesman = get_imc_code($myrow['branch_code']);
$invoicetot = $myrow['ov_amount'] + $dt;
$invoice_discount = $dt / $invoicetot * 100;
$rep->TextCol(0, 1, $myrow['tranDate']);
$rep->TextCol(1, 2, $myrow['br_name']);
$rep->TextCol(2, 3, $salesman);
$rep->TextCol(3, 4, $myrow['customized_no']);
if ($myrow['IsVoid'] == '') {
$rep->AmountCol(4, 5, $invoicetot, 2);
$rep->AmountCol(5, 6, $myrow['ov_amount'], 2);
$rtn_dt = 0;
$res2 = get_return_details($myrow['order_']);
while ($myrow2 = db_fetch($res2)) {
$returns += $myrow2['ov_amount'];
$res2 = get_return_discount($branch_data['sales_discount_account'], $myrow2['type'], $myrow2['trans_no']);
while ($myrow3 = db_fetch($res2)) {
$rtn_dt += abs($myrow3['amount']);
}
}
$net_sales = abs($sales_acct) - $dt - $rtn_dt;
$rep->AmountCol(6, 7, $net_sales, 2);
if ($rtn_dt != 0) {
$rep->AmountCol(7, 8, $rtn_dt, 2);
}
if ($dt != 0) {
$rep->AmountCol(8, 9, $dt, 2);
}
$rep->NewLine();
} else {
$rep->TextCol(4, 5, "Voided");
}
$net_invoice += $invoicetot;
$net_dr += $myrow['ov_amount'];
$net_cr += $net_sales;
$net_return += $rtn_dt;
$net_ret_dt += $dt;
}
$rep->NewLine();
$rep->Font('bold');
$rep->TextCol(1, 2, "TOTAL");
$rep->AmountCol(4, 5, $net_invoice, 2);
$rep->AmountCol(5, 6, $net_dr, 2);
$rep->AmountCol(6, 7, $net_cr, 2);
$rep->AmountCol(7, 8, $net_return, 2);
$rep->AmountCol(8, 9, $net_ret_dt, 2);
$rep->End();
}
示例15: branch_settings
function branch_settings($selected_id)
{
global $Mode, $num_branches;
start_outer_table(TABLESTYLE2);
table_section(1);
$_POST['email'] = "";
if ($selected_id != -1) {
if ($Mode == 'Edit' || !isset($_POST['br_name'])) {
//editing an existing branch
$myrow = get_cust_branch($_POST['customer_id'], $_POST['branch_code']);
set_focus('br_name');
$_POST['branch_code'] = $myrow["branch_code"];
$_POST['br_name'] = $myrow["br_name"];
$_POST['br_ref'] = $myrow["branch_ref"];
$_POST['br_address'] = $myrow["br_address"];
$_POST['br_post_address'] = $myrow["br_post_address"];
// $_POST['contact_name'] = $myrow["contact_name"];
$_POST['salesman'] = $myrow["salesman"];
$_POST['area'] = $myrow["area"];
// $_POST['rep_lang'] =$myrow["rep_lang"];
// $_POST['phone'] =$myrow["phone"];
// $_POST['phone2'] =$myrow["phone2"];
// $_POST['fax'] =$myrow["fax"];
// $_POST['email'] =$myrow["email"];
$_POST['tax_group_id'] = $myrow["tax_group_id"];
$_POST['disable_trans'] = $myrow['disable_trans'];
$_POST['default_location'] = $myrow["default_location"];
$_POST['default_ship_via'] = $myrow['default_ship_via'];
$_POST['sales_account'] = $myrow["sales_account"];
$_POST['sales_discount_account'] = $myrow['sales_discount_account'];
$_POST['receivables_account'] = $myrow['receivables_account'];
$_POST['payment_discount_account'] = $myrow['payment_discount_account'];
$_POST['group_no'] = $myrow["group_no"];
$_POST['notes'] = $myrow["notes"];
}
} elseif ($Mode != 'ADD_ITEM') {
//end of if $SelectedBranch only do the else when a new record is being entered
$myrow = get_default_info_for_branch($_POST['customer_id']);
// $_POST['rep_lang'] = $myrow['rep_lang'];
if (!$num_branches) {
$_POST['br_name'] = $myrow["name"];
$_POST['br_ref'] = $myrow["debtor_ref"];
$_POST['contact_name'] = _('Main Branch');
$_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"];
}
$_POST['branch_code'] = "";
if (!isset($_POST['sales_account']) || !isset($_POST['sales_discount_account'])) {
$company_record = get_company_prefs();
// We use the Item Sales Account as default!
// $_POST['sales_account'] = $company_record["default_sales_act"];
$_POST['sales_account'] = $_POST['notes'] = '';
$_POST['sales_discount_account'] = $company_record['default_sales_discount_act'];
$_POST['receivables_account'] = $company_record['debtors_act'];
$_POST['payment_discount_account'] = $company_record['default_prompt_payment_act'];
}
}
hidden('popup', @$_REQUEST['popup']);
table_section_title(_("Name and Contact"));
text_row(_("Branch Name:"), 'br_name', null, 35, 40);
text_row(_("Branch Short Name:"), 'br_ref', null, 30, 30);
table_section_title(_("Sales"));
sales_persons_list_row(_("Sales Person:"), 'salesman', null);
sales_areas_list_row(_("Sales Area:"), 'area', null);
sales_groups_list_row(_("Sales Group:"), 'group_no', null, true);
locations_list_row(_("Default Inventory Location:"), 'default_location', null);
shippers_list_row(_("Default Shipping Company:"), 'default_ship_via', null);
tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
table_section_title(_("GL Accounts"));
// 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts'
gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, true);
gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true);
gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
table_section(2);
if ($selected_id == -1) {
table_section_title(_("General contact data"));
text_row(_("Contact Person:"), 'contact_name', null, 35, 40);
text_row(_("Phone Number:"), 'phone', null, 32, 30);
text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
text_row(_("Fax Number:"), 'fax', null, 32, 30);
email_row(_("E-mail:"), 'email', null, 35, 55);
languages_list_row(_("Document Language:"), 'rep_lang', null, _("Customer default"));
}
table_section_title(_("Addresses"));
textarea_row(_("Mailing Address:"), 'br_post_address', null, 35, 4);
textarea_row(_("Billing Address:"), 'br_address', null, 35, 4);
textarea_row(_("General Notes:"), 'notes', null, 35, 4);
if ($selected_id != -1) {
yesno_list_row(_("Disable this Branch:"), 'disable_trans', null);
}
end_outer_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
}