function create_cart($type, $trans_no) { global $Refs; if (!$_SESSION['SysPrefs']->db_ok) { // create_cart is called before page() where the check is done return; } processing_start(); if (isset($_GET['NewQuoteToSalesOrder'])) { $trans_no = $_GET['NewQuoteToSalesOrder']; $doc = new Cart(ST_SALESQUOTE, $trans_no, true); $doc->Comments = _("Sales Quotation") . " # " . $trans_no; $_SESSION['Items'] = $doc; } elseif ($type != ST_SALESORDER && $type != ST_SALESQUOTE && $trans_no != 0) { // this is template $doc = new Cart(ST_SALESORDER, array($trans_no)); $doc->trans_type = $type; $doc->trans_no = 0; $doc->document_date = new_doc_date(); if ($type == ST_SALESINVOICE) { $doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date); $doc->pos = get_sales_point(user_pos()); } else { $doc->due_date = $doc->document_date; } $doc->reference = $Refs->get_next($doc->trans_type); //$doc->Comments=''; foreach ($doc->line_items as $line_no => $line) { $doc->line_items[$line_no]->qty_done = 0; } $_SESSION['Items'] = $doc; } else { $_SESSION['Items'] = new Cart($type, array($trans_no)); } copy_from_cart(); }
inactive_control_cell($myrow["id"], $myrow["inactive"], "sales_pos", 'id'); edit_button_cell("Edit" . $myrow['id'], _("Edit")); delete_button_cell("Delete" . $myrow['id'], _("Delete")); end_row(); } inactive_control_row($th); end_table(1); //---------------------------------------------------------------------------------------------------- $cash = db_has_cash_accounts(); if (!$cash) { display_note(_("To have cash POS first define at least one cash bank account.")); } start_table(TABLESTYLE2); if ($selected_id != -1) { if ($Mode == 'Edit') { $myrow = get_sales_point($selected_id); $_POST['name'] = $myrow["pos_name"]; $_POST['location'] = $myrow["pos_location"]; $_POST['account'] = $myrow["pos_account"]; 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); if ($cash) { check_row(_('Allowed credit sale terms selection:'), 'credit', check_value('credit_sale'));