function bank_accounts_list($name, $selected_id=null, $submit_on_change=false)
{
$sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code
- FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master
- WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code";
+ FROM ".TB_PREF."bank_accounts";
+// , ".TB_PREF."chart_master
+// WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code";
return combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false)
{
- $sql = "SELECT ".TB_PREF."bank_accounts.account_code, bank_account_name, bank_curr_code
- FROM ".TB_PREF."bank_accounts, ".TB_PREF."chart_master
- WHERE ".TB_PREF."bank_accounts.account_code=".TB_PREF."chart_master.account_code"
- . " AND ".TB_PREF."bank_accounts.account_type=3";
+ $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code
+ FROM ".TB_PREF."bank_accounts
+ WHERE ".TB_PREF."bank_accounts.account_type=3";
if ($label != null)
echo "<tr><td>$label</td>\n";
echo "<td>";
- $str = combo_input($name, $selected_id, $sql, 'account_code', 'bank_account_name',
+ $str = combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
'format' => '_format_add_curr',
'select_submit'=> $submit_on_change,
FROM (".TB_PREF."chart_master chart,".TB_PREF."chart_types type) "
."LEFT JOIN ".TB_PREF."bank_accounts acc "
."ON chart.account_code=acc.account_code
- WHERE acc.account_code IS NULL
+ WHERE acc.account_code IS NULL
AND chart.account_type=type.id";
else
$sql = "SELECT chart.account_code, chart.account_name, type.name
.TB_PREF."sales_pos as pos,"
.TB_PREF."locations as loc,"
.TB_PREF."bank_accounts as acc"
- ." WHERE pos.pos_location=loc.loc_code AND pos.pos_account=acc.account_code";
+ ." WHERE pos.pos_location=loc.loc_code AND pos.pos_account=acc.id";
return db_query($sql, "could not get all POS definitions");
}
.TB_PREF."sales_pos as pos,"
.TB_PREF."locations as loc,"
.TB_PREF."bank_accounts as acc"
- ." WHERE pos.id=$id AND pos.pos_location=loc.loc_code AND pos.pos_account=acc.account_code";
+ ." WHERE pos.id=$id AND pos.pos_location=loc.loc_code AND pos.pos_account=acc.id";
$result = db_query($sql, "could not get POS definition");
$_POST['name'] = $myrow["pos_name"];
$_POST['location'] = $myrow["pos_location"];
$_POST['account'] = $myrow["pos_account"];
- $_POST['credit_sale'] = $myrow["credit_sale"];
- $_POST['cash_sale'] = $myrow["cash_sale"];
+ if ($myrow["credit_sale"]) $_POST['credit_sale'] = 1;
+ if ($myrow["cash_sale"]) $_POST['cash_sale'] = 1;
}
hidden('selected_id', $selected_id);
}
text_row_ex(_("Point of Sale Name").':', 'name', 20, 30);
-check_row(_('Allowed credit sale'), 'credit', null);
-check_row(_('Allowed cash sale'), 'cash', null);
+check_row(_('Allowed credit sale'), 'credit', check_value('credit_sale'));
+check_row(_('Allowed cash sale'), 'cash', check_value('cash_sale'));
locations_list_row(_("POS location").':', 'location');
cash_accounts_list_row(_("Default cash account").':', 'account');
UNIQUE KEY(`pos_name`)
) ENGINE=MyISAM AUTO_INCREMENT=3;
-INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1705');
-INSERT INTO `0_sales_pos` VALUES ('2', 'Cash sale', '1', '0', 'CWA', '1705');
+INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1');
ALTER TABLE `0_users` ADD `pos` SMALLINT(6) DEFAULT '1';