{
if (isset($_SESSION['pay_items']))
{
- $_SESSION['pay_items']->clear_items();
unset ($_SESSION['pay_items']);
}
if (isset($_POST['go']))
{
display_quick_entries($_SESSION['pay_items'], $_POST['person_id'], input_num('totamount'),
- $_SESSION['pay_items']->trans_type==systypes::bank_payment());
+ $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? QE_PAYMENT : QE_DEPOSIT);
+ $_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
line_start_focus();
}
//-----------------------------------------------------------------------------------------------
if (isset($_POST['go']))
{
- display_quick_entries($_SESSION['journal_items'], $_POST['person_id'], input_num('totamount'));
+ display_quick_entries($_SESSION['journal_items'], $_POST['person_id'], input_num('totamount'), QE_JOURNAL);
+ $_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
line_start_focus();
}
//-----------------------------------------------------------------------------------------------
hidden('PersonDetailID');
}
break;
+
case payment_person_types::QuickEntry() :
- quick_entries_list_row(_("Description:"), 'person_id', null, ($payment ? 0 : 1), 1);
- amount_row(_("Total Amount"), 'totamount', null, null, " ".submit('go', _("Go"), false, false, true));
+ quick_entries_list_row(_("Type").":", 'person_id', null, ($payment ? QE_PAYMENT : QE_DEPOSIT), true);
+ $qid = get_quick_entry(get_post('person_id'));
+ if (list_updated('person_id')) {
+ unset($_POST['totamount']); // enable default
+ $Ajax->activate('totamount');
+ }
+ amount_row($qid['base_desc'].":", 'totamount', price_format($qid['base_amount']),
+ null, " ".submit('go', _("Go"), false, false, true));
break;
//case payment_person_types::Project() :
// dimensions_list_row(_("Dimension:"), 'person_id', $_POST['person_id'], false, null, true);
{
global $table_style2;
- $qes = has_quick_entries(-1, 0);
+ $qes = has_quick_entries(QE_JOURNAL);
start_outer_table("$table_style2 width=90%");
table_section(1);
{
table_section(3, "50%");
start_row();
- quick_entries_list_cells(_("Quick Entry:"), 'person_id', null, -1, 0);
- amount_cells(_("Total Amount"), 'totamount', null, null, " ".submit('go', _("Go"), false, false, true));
+ quick_entries_list_cells(_("Quick Entry").":", 'person_id', null, QE_JOURNAL, true);
+ $qid = get_quick_entry(get_post('person_id'));
+ if (list_updated('person_id')) {
+ unset($_POST['totamount']); // enable default
+ $Ajax->activate('totamount');
+ }
+ amount_cells($qid['base_desc'].":", 'totamount', price_format($qid['base_amount']),
+ null, " ".submit('go', _("Go"), false, false, true));
end_row();
+
}
end_outer_table(1);
set_focus('description');
return false;
}
+ if (strlen($_POST['base_desc']) == 0)
+ {
+ display_error( _("The base amount description cannot be empty."));
+ set_focus('base_desc');
+ return false;
+ }
return true;
}
if ($selected_id != -1)
{
- update_quick_entry($selected_id, $_POST['description'], $_POST['deposit'], $_POST['bank_only']);
+ update_quick_entry($selected_id, $_POST['description'], $_POST['type'],
+ input_num('base_amount'), $_POST['base_desc']);
display_notification(_('Selected quick entry has been updated'));
}
else
{
- add_quick_entry($_POST['description'], $_POST['deposit'], $_POST['bank_only']);
+ add_quick_entry($_POST['description'], $_POST['type'],
+ input_num('base_amount'), $_POST['base_desc']);
display_notification(_('New quick entry has been added'));
}
$Mode = 'RESET';
{
if ($selected_id2 != -1)
{
- update_quick_entry_line($selected_id2, $selected_id, $_POST['account'], $_POST['tax_acc'], $_POST['pct'], input_num('amount', 0),
+ update_quick_entry_line($selected_id2, $selected_id, $_POST['actn'], $_POST['dest_id'], input_num('amount', 0),
$_POST['dimension_id'], $_POST['dimension2_id']);
display_notification(_('Selected quick entry line has been updated'));
}
else
{
- add_quick_entry_line($selected_id, $_POST['account'], $_POST['tax_acc'], $_POST['pct'], input_num('amount', 0),
+ add_quick_entry_line($selected_id, $_POST['actn'], $_POST['dest_id'], input_num('amount', 0),
$_POST['dimension_id'], $_POST['dimension2_id']);
display_notification(_('New quick entry line has been added'));
}
if ($Mode == 'RESET')
{
$selected_id = -1;
- $_POST['description'] = $_POST['deposit'] = $_POST['bank_only'] = '';
+ $_POST['description'] = $_POST['type'] = '';
+ $_POST['base_desc']= _('Base Amount');
+ $_POST['base_amount'] = price_format(0);
}
if ($Mode2 == 'RESET2')
{
$selected_id2 = -1;
- $_POST['account'] = $_POST['tax_acc'] = $_POST['pct'] = $_POST['amount'] = $_POST['dimension_id'] = $_POST['dimension2_id'] = '';
+ $_POST['actn'] = $_POST['dest_id'] = $_POST['amount'] =
+ $_POST['dimension_id'] = $_POST['dimension2_id'] = '';
}
//-----------------------------------------------------------------------------------
$result = get_quick_entries();
start_form();
start_table($table_style);
-$th = array(_("Description"), _("Deposit"), _("Bank Only"), "", "");
+$th = array(_("Description"), _("Type"), "", "");
table_header($th);
$k = 0;
while ($myrow = db_fetch($result))
{
alt_table_row_color($k);
- $deposit_text = ($myrow["deposit"] == 0 ? _("No") : _("Yes"));
- $bank_text = ($myrow["bank_only"] == 0 ? _("No") : _("Yes"));
+ $type_text = $quick_entry_types[$myrow["type"]];
label_cell($myrow['description']);
- label_cell($deposit_text);
- label_cell($bank_text);
+ label_cell($type_text);
edit_button_cell("Edit".$myrow["id"], _("Edit"));
delete_button_cell("Delete".$myrow["id"], _("Delete"));
end_row();
}
-end_table();
+end_table(1);
end_form();
//-----------------------------------------------------------------------------------
$_POST['id'] = $myrow["id"];
$_POST['description'] = $myrow["description"];
- $_POST['deposit'] = $myrow["deposit"];
- $_POST['bank_only'] = $myrow["bank_only"];
+ $_POST['deposit'] = $myrow["type"];
+ $_POST['base_desc'] = $myrow["base_desc"];
+ $_POST['base_amount'] = price_format($myrow["base_amount"]);
hidden('selected_id', $selected_id);
//}
}
-text_row_ex(_("Description:"), 'description', 50, 60);
+text_row_ex(_("Description").':', 'description', 50, 60);
+
+quick_entry_types_list_row(_("Entry Type").':', 'type');
-yesno_list_row(_("Deposit:"), 'deposit', null, "", "", false);
+text_row_ex(_("Base Amount Description").':', 'base_desc', 50, 60, '',_('Base Amount'));
-yesno_list_row(_("Bank Only:"), 'bank_only', null, "", "", false);
+amount_row(_("Default Base Amount").':', 'base_amount', price_format(0));
end_table(1);
end_form();
+
if ($selected_id != -1)
{
display_heading(_("Quick Entry Lines") . " - " . $_POST['description']);
start_table($table_style2);
$dim = get_company_pref('use_dimension');
if ($dim == 2)
- $th = array(_("Account"), _("Use Tax"), _("Percent"), _("Amount"), _("Dimension"), _("Dimension")." 2", "", "");
+ $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), _("Dimension")." 2", "", "");
else if ($dim == 1)
- $th = array(_("Account"), _("Use Tax"), _("Percent"), _("Amount"), _("Dimension"), "", "");
+ $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), _("Dimension"), "", "");
else
- $th = array(_("Account"), _("Use Tax"), _("Percent"), _("Amount"), "", "");
+ $th = array(_("Post"), _("Account/Tax Type"), _("Amount"), "", "");
+
table_header($th);
$k = 0;
while ($myrow = db_fetch($result))
{
alt_table_row_color($k);
- label_cell($myrow['account']." ".$myrow['account_name']);
- $tax_text = ($myrow['tax_acc'] == 0 ? _("No") : _("Yes"));
- label_cell($tax_text);
- $pct_text = ($myrow['pct'] == 0 ? _("No") : _("Yes"));
- label_cell($pct_text);
- amount_cell($myrow['amount']);
+
+ label_cell($quick_actions[$myrow['action']]);
+
+ $act_type = strtolower(substr($myrow['action'], 0, 1));
+
+ if ($act_type == 't') {
+ label_cells($myrow['tax_name'], '');
+ } else {
+ label_cell($myrow['dest_id'].' '.$myrow['account_name']);
+ if ($act_type == '=')
+ label_cell('');
+ else
+ if ($act_type == '%')
+ percent_cell($myrow['amount']);
+ else
+ amount_cell($myrow['amount']);
+ }
if ($dim >= 1)
label_cell(get_dimension_string($myrow['dimension_id'], true));
if ($dim > 1)
delete_button_cell("BDel".$myrow["id"], _("Delete"));
end_row();
}
- end_table();
+ end_table(1);
hidden('selected_id', $selected_id);
hidden('selected_id2', $selected_id2);
hidden('description', $_POST['description']);
- hidden('deposit', $_POST['deposit']);
- hidden('bank_only', $_POST['bank_only']);
+ hidden('type', $_POST['type']);
end_form();
start_form();
+ div_start('edit_line');
start_table($table_style2);
if ($selected_id2 != -1)
$myrow = get_quick_entry_line($selected_id2);
$_POST['id'] = $myrow["id"];
- $_POST['account'] = $myrow["account"];
- $_POST['tax_acc'] = $myrow["tax_acc"];
- $_POST['pct'] = $myrow["pct"];
+ $_POST['dest_id'] = $myrow["dest_id"];
+ $_POST['actn'] = $myrow["action"];
$_POST['amount'] = $myrow["amount"];
$_POST['dimension_id'] = $myrow["dimension_id"];
$_POST['dimension2_id'] = $myrow["dimension2_id"];
}
}
- gl_all_accounts_list_row(_("Account"), 'account', null);
- yesno_list_row(_("Use Tax:"), 'tax_acc', null, "", "", false);
- yesno_list_row(_("Use Percent:"), 'pct', null, "", "", false);
- amount_row(_("Amount"), 'amount', null);
+ quick_actions_list_row(_("Posted").":",'actn', null, true);
+ if (list_updated('actn'))
+ $Ajax->activate('edit_line');
+
+ $actn = strtolower(substr($_POST['actn'],0,1));
+
+ if ($actn == 't') {
+ item_tax_types_list_row(_("Item Tax Type").":",'dest_id', null);
+ } else {
+ gl_all_accounts_list_row(_("Account").":", 'dest_id', null);
+ if ($actn != '=') {
+ if ($actn = '%')
+ percent_row(_("Part").":", 'amount', percent_format(0));
+ else
+ amount_row(_("Amount").":", 'amount', price_format(0));
+ }
+ }
if ($dim >= 1)
- dimensions_list_row(_("Dimension"), 'dimension_id', null, true, " ", false, 1);
+ dimensions_list_row(_("Dimension").":", 'dimension_id', null, true, " ", false, 1);
if ($dim > 1)
- dimensions_list_row(_("Dimension")." 2", 'dimension2_id', null, true, " ", false, 2);
+ dimensions_list_row(_("Dimension")." 2:", 'dimension2_id', null, true, " ", false, 2);
end_table(1);
if ($dim < 2)
hidden('dimension2_id', 0);
if ($dim < 1)
hidden('dimension_id', 0);
+ div_end();
+
hidden('selected_id', $selected_id);
hidden('selected_id2', $selected_id2);
hidden('description', $_POST['description']);
- hidden('deposit', $_POST['deposit']);
- hidden('bank_only', $_POST['bank_only']);
+ hidden('type', $_POST['type']);
submit_add_or_update_center2($selected_id2 == -1, '', true);
}
}
+$quick_actions = array(
+ '=' => _('Remainder'), // post current base amount to GL account
+ '-' => _('Amount, reduce base'), // post amount to GL account and reduce base
+ '+' => _('Amount, increase base'), // post amount to GL account and increase base
+ '%' => _('% amount of base'), // store acc*amount% to GL account
+ '%+' => _('% amount of base, increase base'), // ditto & increase base amount
+ '%-' => _('% amount of base, reduce base'), // ditto & reduce base amount
+ 'T' => _('Taxes added'), // post taxes calculated on base amount
+ 'T+' => _('Taxes added, increase base'), // ditto & increase base amount
+ 'T-' => _('Taxes added, reduce base'), // ditto & reduce base amount
+ 't' => _('Taxes included'), // post taxes calculated on base amount
+ 't+' => _('Taxes included, increase base'), // ditto & increase base amount
+ 't-' => _('Taxes included, reduce base') // ditto & reduce base amount
+);
+
+define('QE_DEPOSIT', '1');
+define('QE_PAYMENT', '2');
+define('QE_JOURNAL', '3');
+define('QE_SUPPINV', '4');
+
+$quick_entry_types = array(
+ QE_DEPOSIT => _("Bank Deposit"),
+ QE_PAYMENT => _("Bank Payment"),
+ QE_JOURNAL => _("Journal Entry"),
+ QE_SUPPINV => _("Supplier Invoice/Credit")
+);
+
+
?>
\ No newline at end of file
else
{
// shouldn't come here under normal circumstances
- display_db_error("unexpected - adding an invalid item or null quantity", "", true);
+ display_db_error("unexpected - invalid parameters in add_gl_item($code_id, $dimension_id, $dimension2_id, $amount,...)", "", true);
}
return false;
return $str;
}
-//------------------------------------------------------------------------------------------------
-
-function quick_entries_list($name, $selected_id=null, $expense=-1, $bank_only=-1, $submit_on_change=false)
-{
- $where = false;
- $sql = "SELECT id, description FROM ".TB_PREF."quick_entries";
- if ($expense != -1)
- {
- $sql .= " WHERE deposit=$expense";
- $where = true;
- }
- if ($bank_only != -1)
- {
- if ($where)
- $sql .= " AND bank_only=$bank_only";
- else
- $sql .= " WHERE bank_only=$bank_only";
- }
- combo_input($name, $selected_id, $sql, 'id', 'description',
- array(
- 'spec_id' => '',
- 'order' => 'description',
- 'select_submit'=> $submit_on_change,
- 'async' => false
- ) );
-
-}
-
-function quick_entries_list_cells($label, $name, $selected_id=null, $expense=-1, $bank_only=-1, $submit_on_change=false)
-{
- echo "<td>$label</td><td>\n";
- quick_entries_list($name, $selected_id, $expense, $bank_only, $submit_on_change);
- echo "</td>";
-}
-
-function quick_entries_list_row($label, $name, $selected_id=null, $expense=-1, $bank_only=-1, $submit_on_change=false)
-{
- echo "<tr>\n";
- quick_entries_list_cells($label, $name, $selected_id, $expense, $bank_only, $submit_on_change);
- echo "</tr>\n";
-}
-
-
//------------------------------------------------------------------------------------------------
function wo_types_list($name, $selected_id=null)
));
}
+//------------------------------------------------------------------------------------------------
+
+function quick_entries_list($name, $selected_id=null, $type=null, $submit_on_change=false)
+{
+ $where = false;
+ $sql = "SELECT id, description FROM ".TB_PREF."quick_entries";
+ if ($type != null)
+ $sql .= " WHERE type=$type";
+
+ combo_input($name, $selected_id, $sql, 'id', 'description',
+ array(
+ 'spec_id' => '',
+ 'order' => 'description',
+ 'select_submit'=> $submit_on_change,
+ 'async' => false
+ ) );
+
+}
+
+function quick_entries_list_cells($label, $name, $selected_id=null, $type, $submit_on_change=false)
+{
+ echo "<td>$label</td><td>\n";
+ quick_entries_list($name, $selected_id, $type, $submit_on_change);
+ echo "</td>";
+}
+
+function quick_entries_list_row($label, $name, $selected_id=null, $type, $submit_on_change=false)
+{
+ echo "<tr>\n";
+ quick_entries_list_cells($label, $name, $selected_id, $type, $submit_on_change);
+ echo "</tr>\n";
+}
+
+
+function quick_actions_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+{
+ global $quick_actions;
+
+ echo "<tr><td>$label</td><td>";
+ array_selector($name, $selected_id, $quick_actions,
+ array(
+ 'select_submit'=> $submit_on_change
+ ) );
+ echo "</td></tr>\n";
+}
+
+function quick_entry_types_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+{
+ global $quick_entry_types;
+
+ echo "<tr><td>$label</td><td>";
+ array_selector($name, $selected_id, $quick_entry_types,
+ array(
+ 'select_submit'=> $submit_on_change
+ ) );
+ echo "</td></tr>\n";
+}
+
?>
\ No newline at end of file
}
//--------------------------------------------------------------------------------------
-function display_quick_entries(&$cart, $id, $totamount, $payment=true, $supp_trans=false)
+//
+// Expands selected quick entry $id into GL posings and adds to cart.
+// returns calculated amount posted to bank GL account.
+//
+function display_quick_entries(&$cart, $id, $base, $type, $descr='')
{
+ $bank_amount = 0;
+
if (!isset($id) || $id == null || $id == "")
{
display_error( _("No Quick Entries are defined."));
}
else
{
- $rate = 0;
- if (!$payment)
- $totamount = -$totamount;
- if (!$supp_trans)
+ if ($type == QE_DEPOSIT)
+ $base = -$base;
+ if ($type != QE_SUPPINV) // only one quick entry on journal/bank transaction
$cart->clear_items();
$qe = get_quick_entry($id);
+ if ($descr != '') $qe['description'] .= ': '.$descr;
$qe_lines = get_quick_entry_lines($id);
while ($qe_line = db_fetch($qe_lines))
{
- if ($qe_line['tax_acc'])
- {
- $account = get_gl_account($qe_line['account']);
- $tax_group = $account['tax_code'];
- $items = get_tax_group_items($tax_group);
- while ($item = db_fetch($items))
- $rate += $item['rate'];
- if ($rate != 0)
- $totamount = round2($totamount * 100 / ($rate + 100), user_price_dec());
- //$cart->clear_items();
- if (!$supp_trans)
- $cart->add_gl_item($qe_line['account'], $qe_line['dimension_id'], $qe_line['dimension2_id'],
- $totamount, $qe['description']);
- else
- {
- $acc_name = get_gl_account_name($qe_line['account']);
- $cart->add_gl_codes_to_trans($qe_line['account'], $acc_name, $qe_line['dimension_id'],
- $qe_line['dimension2_id'], $totamount, $qe['description']);
- }
- $items = get_tax_group_items($tax_group);
- while ($item = db_fetch($items))
- {
- if ($item['rate'] != 0)
- {
- $amount = round2($totamount * $item['rate'] / 100, user_price_dec());
- $code = (($amount < 0 || $payment || $supp_trans) ? $item['purchasing_gl_code'] :
- $item['sales_gl_code']);
- if (!$supp_trans)
- $cart->add_gl_item($code, 0, 0, $amount, $qe['description']);
+ switch (strtolower($qe_line['action'])) {
+ case "=": // post current base amount to GL account
+ $part = $base;
+ break;
+ case "-": // post amount to GL account and reduce base
+ $part = $qe_line['amount']; $base -= $part;
+ break;
+ case "+": // post amount to GL account and increase base
+ $part = $qe_line['amount']; $base += $part;
+ break;
+ case "%": // store acc*amount% to GL account
+ $part = round2($base * $qe_line['amount'] / 100, user_price_dec());
+ break;
+ case "%+": // ditto & increase base amount
+ $part = round2($base * $qe_line['amount'] / 100, user_price_dec());
+ $base += $part;
+ break;
+ case "%-": // ditto & reduce base amount
+ $part = round2($base * $qe_line['amount'] / 100, user_price_dec());
+ $base -= $part;
+ break;
+ case "t": // post taxes calculated on base amount
+ case "t+": // ditto & increase base amount
+ case "t-": // ditto & reduce base amount
+ $taxes = get_taxes_for_item_tax($qe_line['dest_id']);
+ $tax_total = 0;
+ foreach ($taxes as $index => $item_tax) {
+ if(substr($qe_line['action'],0,1) != 'T')
+ $tax = round($base * $item_tax['rate']
+ / ($item_tax['rate'] + 100), user_price_dec());
else
- {
- $acc_name = get_gl_account_name($code);
- $cart->add_gl_codes_to_trans($code, $acc_name, 0, 0, $amount, $qe['description']);
+ $tax = round($base * $item_tax['rate'] / 100, user_price_dec());
+
+ $gl_code = $type != QE_DEPOSIT
+ ? $item_tax['purchasing_gl_code'] : $item_tax['sales_gl_code'];
+ $tax_total += $tax;
+ if ($type != QE_SUPPINV)
+ $cart->add_gl_item($gl_code,
+ $qe_line['dimension_id'], $qe_line['dimension2_id'],
+ $tax, $qe['description']);
+ else {
+ $acc_name = get_gl_account_name($gl_code);
+ $cart->add_gl_codes_to_trans($gl_code,
+ $acc_name, $qe_line['dimension_id'],
+ $qe_line['dimension2_id'], $tax, $qe['description']);
}
}
- }
+ if (strpos($qe_line['action'], '+'))
+ $base += $tax_total;
+ elseif (strpos($qe_line['action'], '-'))
+ $base -= $tax_total;
+ continue 2;
+ }
+ if ($type != QE_SUPPINV)
+ $cart->add_gl_item($qe_line['dest_id'], $qe_line['dimension_id'],
+ $qe_line['dimension2_id'], $part, $qe['description']);
+ else {
+ $acc_name = get_gl_account_name($qe_line['dest_id']);
+ $cart->add_gl_codes_to_trans($qe_line['dest_id'],
+ $acc_name, $qe_line['dimension_id'],
+ $qe_line['dimension2_id'], $part, $qe['description']);
}
- else
- {
- if ($qe_line['pct'])
- $amount = round2($totamount * $qe_line['amount'] / 100, user_price_dec());
- else
- $amount = $qe_line['amount'];
- if (!$supp_trans)
- $cart->add_gl_item($qe_line['account'], $qe_line['dimension_id'], $qe_line['dimension2_id'],
- $amount, $qe['description']);
- else
- {
- $acc_name = get_gl_account_name($qe_line['account']);
- $cart->add_gl_codes_to_trans($qe_line['account'], $acc_name, $qe_line['dimension_id'],
- $qe_line['dimension2_id'], $amount, $qe['description']);
- }
- }
}
- //line_start_focus();
}
+ return $bank_amount;
}
function display_gl_items(&$supp_trans, $mode=0)
{
- global $table_style, $path_to_root;
+ global $table_style, $path_to_root, $Ajax;
// if displaying in form, and no items, exit
if (($mode == 2 || $mode == 3) && count($supp_trans->gl_codes) == 0)
if ($mode == 1)
{
- $qes = has_quick_entries(-1, 0);
+ $qes = has_quick_entries(QE_SUPPINV);
if ($qes !== false)
{
echo "<div style='float:right;'>";
echo _("Quick Entry:")." ";
- quick_entries_list('qid', null, 0, 1);
- echo " "._("Amount")." ";
- $amount = input_num('totamount');
+ quick_entries_list('qid', null, QE_SUPPINV, true);
+ $qid = get_quick_entry(get_post('qid'));
+ if (list_updated('qid')) {
+ unset($_POST['totamount']); // enable default
+ $Ajax->activate('totamount');
+ }
+ echo " ".$qid['base_desc'].":"." ";
+
+ $amount = input_num('totamount', $qid['base_amount']);
$dec = user_price_dec();
echo "<input class='amount' type='text' name='totamount' size='7' maxlength='12' dec='$dec' value='$amount'> ";
submit('go', _("Go"), true, false, true);
echo "</div>";
+
}
}
display_heading($heading);
if (isset($_POST['go']))
{
$Ajax->activate('gl_items');
- display_quick_entries($_SESSION['supp_trans'], $_POST['qid'], input_num('totamount'), true, true);
+ display_quick_entries($_SESSION['supp_trans'], $_POST['qid'], input_num('totamount'), QE_SUPPINV);
+ $_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
$Ajax->activate('inv_tot');
}
if (isset($_POST['go']))
{
$Ajax->activate('gl_items');
- display_quick_entries($_SESSION['supp_trans'], $_POST['qid'], input_num('totamount'), true, true);
+ display_quick_entries($_SESSION['supp_trans'], $_POST['qid'], input_num('totamount'), QE_SUPPINV);
+ $_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
$Ajax->activate('inv_tot');
}
CREATE TABLE `0_quick_entries` (
`id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `type` tinyint(1) NOT NULL default '0',
`description` varchar(60) NOT NULL,
- `deposit` tinyint(1) NOT NULL default '0',
- `bank_only` tinyint(1) NOT NULL default '0',
+ `base_amount` double NOT NULL default '0',
+ `base_desc` varchar(60) NULL,
PRIMARY KEY (`id`),
KEY `description` (`description`)
) TYPE=MyISAM AUTO_INCREMENT=1;
-INSERT INTO `0_quick_entries` VALUES ('1', 'Maintenance', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('2', 'Phone', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('3', 'Cash Sales', '1', '1');
+INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('2', '1', 'Phone', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount');
DROP TABLE IF EXISTS `0_quick_entry_lines`;
CREATE TABLE `0_quick_entry_lines` (
`id` smallint(6) UNSIGNED NOT NULL auto_increment,
`qid` smallint(6) UNSIGNED NOT NULL,
- `account` varchar(11) NOT NULL,
- `tax_acc` tinyint(1) NOT NULL default '0',
- `pct` tinyint(1) NOT NULL default '0',
`amount` double default NULL default '0',
+ `action` varchar(2) NOT NULL,
+ `dest_id` varchar(11) NOT NULL,
`dimension_id` smallint(6) UNSIGNED NULL default NULL,
`dimension2_id` smallint(6) UNSIGNED NULL default NULL,
PRIMARY KEY (`id`),
KEY `qid` (`qid`)
) TYPE=MyISAM AUTO_INCREMENT=1;
-INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '6600', '1', '0', 0, '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '6730', '1', '0', 0, '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '3000', '1', '0', 0, '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('1', '1','0','=', '6600', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('2', '2','0','=', '6730', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('3', '3','0','=', '3000', '0', '0');
ALTER TABLE `0_users` DROP COLUMN `print_profile`;
ALTER TABLE `0_users` ADD `print_profile` VARCHAR(30) NOT NULL DEFAULT '1';
INSERT INTO `0_purch_orders` VALUES ('13', '0', '4', '', '2008-03-25', '14', '', 'DEF', 'N/A');
INSERT INTO `0_purch_orders` VALUES ('14', '0', '1', '', '2009-01-10', '15', '', 'CWA', 'address');
-
### Structure of table `0_quick_entries` ###
DROP TABLE IF EXISTS `0_quick_entries`;
CREATE TABLE `0_quick_entries` (
- `id` smallint(6) unsigned NOT NULL auto_increment,
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `type` tinyint(1) NOT NULL default '0',
`description` varchar(60) NOT NULL,
- `deposit` tinyint(1) NOT NULL default '0',
- `bank_only` tinyint(1) NOT NULL default '0',
+ `base_amount` double NOT NULL default '0',
+ `base_desc` varchar(60) NULL,
PRIMARY KEY (`id`),
KEY `description` (`description`)
-) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
-
+) TYPE=MyISAM AUTO_INCREMENT=1;
### Data of table `0_quick_entries` ###
-INSERT INTO `0_quick_entries` VALUES ('1', 'Maintenance', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('2', 'Phone', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('3', 'Cash Sales', '1', '1');
-
+INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('2', '1', 'Phone', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount');
### Structure of table `0_quick_entry_lines` ###
DROP TABLE IF EXISTS `0_quick_entry_lines`;
CREATE TABLE `0_quick_entry_lines` (
- `id` smallint(6) unsigned NOT NULL auto_increment,
- `qid` smallint(6) unsigned NOT NULL,
- `account` varchar(11) NOT NULL,
- `tax_acc` tinyint(1) NOT NULL default '0',
- `pct` tinyint(1) NOT NULL default '0',
- `amount` double default '0',
- `dimension_id` smallint(6) unsigned default NULL,
- `dimension2_id` smallint(6) unsigned default NULL,
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `qid` smallint(6) UNSIGNED NOT NULL,
+ `amount` double default NULL default '0',
+ `action` varchar(2) NOT NULL,
+ `dest_id` varchar(11) NOT NULL,
+ `dimension_id` smallint(6) UNSIGNED NULL default NULL,
+ `dimension2_id` smallint(6) UNSIGNED NULL default NULL,
PRIMARY KEY (`id`),
KEY `qid` (`qid`)
-) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
-
+) TYPE=MyISAM AUTO_INCREMENT=1;
### Data of table `0_quick_entry_lines` ###
-INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '6600', '1', '0', '0', '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '6730', '1', '0', '0', '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '3000', '1', '0', '0', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('1', '1','0','=', '6600', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('2', '2','0','=', '6730', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('3', '3','0','=', '3000', '0', '0');
### Structure of table `0_recurrent_invoices` ###
### Data of table `0_purch_orders` ###
-
-
### Structure of table `0_quick_entries` ###
DROP TABLE IF EXISTS `0_quick_entries`;
CREATE TABLE `0_quick_entries` (
- `id` smallint(6) unsigned NOT NULL auto_increment,
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `type` tinyint(1) NOT NULL default '0',
`description` varchar(60) NOT NULL,
- `deposit` tinyint(1) NOT NULL default '0',
- `bank_only` tinyint(1) NOT NULL default '0',
+ `base_amount` double NOT NULL default '0',
+ `base_desc` varchar(60) NULL,
PRIMARY KEY (`id`),
KEY `description` (`description`)
-) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
-
+) TYPE=MyISAM AUTO_INCREMENT=1;
### Data of table `0_quick_entries` ###
-INSERT INTO `0_quick_entries` VALUES ('1', 'Maintenance', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('2', 'Phone', '0', '1');
-INSERT INTO `0_quick_entries` VALUES ('3', 'Cash Sales', '1', '1');
-
-
### Structure of table `0_quick_entry_lines` ###
DROP TABLE IF EXISTS `0_quick_entry_lines`;
CREATE TABLE `0_quick_entry_lines` (
- `id` smallint(6) unsigned NOT NULL auto_increment,
- `qid` smallint(6) unsigned NOT NULL,
- `account` varchar(11) NOT NULL,
- `tax_acc` tinyint(1) NOT NULL default '0',
- `pct` tinyint(1) NOT NULL default '0',
- `amount` double default '0',
- `dimension_id` smallint(6) unsigned default NULL,
- `dimension2_id` smallint(6) unsigned default NULL,
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `qid` smallint(6) UNSIGNED NOT NULL,
+ `amount` double default NULL default '0',
+ `action` varchar(2) NOT NULL,
+ `dest_id` varchar(11) NOT NULL,
+ `dimension_id` smallint(6) UNSIGNED NULL default NULL,
+ `dimension2_id` smallint(6) UNSIGNED NULL default NULL,
PRIMARY KEY (`id`),
KEY `qid` (`qid`)
-) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
-
+) TYPE=MyISAM AUTO_INCREMENT=1;
### Data of table `0_quick_entry_lines` ###
-INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '6600', '1', '0', '0', '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '6730', '1', '0', '0', '0', '0');
-INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '3000', '1', '0', '0', '0', '0');
-
-
### Structure of table `0_recurrent_invoices` ###
DROP TABLE IF EXISTS `0_recurrent_invoices`;