$myrow = get_recurrent_invoice($selected_id);
        $_POST['description'] = $myrow["description"];
        $_POST['order_no'] = $myrow["order_no"];
        $_POST['debtor_no'] = $myrow["debtor_no"];
        $_POST['group_no'] = $myrow["group_no"];
        $_POST['days'] = $myrow["days"];
        $_POST['monthly'] = $myrow["monthly"];
        $_POST['begin'] = sql2date($myrow["begin"]);
        $_POST['end'] = sql2date($myrow["end"]);
        $_POST['last_sent'] = $myrow['last_sent'] == "0000-00-00" ? "" : sql2date($myrow["last_sent"]);
    }
    hidden("selected_id", $selected_id);
}
text_row_ex(_("Description:"), 'description', 50);
templates_list_row(_("Template:"), 'order_no');
customer_list_row(_("Customer:"), 'debtor_no', null, " ", true);
if ($_POST['debtor_no'] > 0) {
    customer_branches_list_row(_("Branch:"), $_POST['debtor_no'], 'group_no', null, false);
} else {
    sales_groups_list_row(_("Sales Group:"), 'group_no', null, " ");
}
small_amount_row(_("Days:"), 'days', 0, null, null, 0);
small_amount_row(_("Monthly:"), 'monthly', 0, null, null, 0);
date_row(_("Begin:"), 'begin');
date_row(_("End:"), 'end', null, null, 0, 0, 5);
if ($selected_id != -1 && $_POST['last_sent'] != "") {
    date_row(_("Last Created"), 'last_sent');
}
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
Esempio n. 2
0
            $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT, $_POST['trans_no']);
        } else {
            $_SESSION['alloc'] = new allocation(ST_CUSTPAYMENT, 0);
            $Ajax->activate('alloc_tbl');
        }
    }
}
//----------------------------------------------------------------------------------------------
$new = !$_SESSION['alloc']->trans_no;
start_form();
hidden('trans_no');
hidden('old_ref', $old_ref);
start_outer_table(TABLESTYLE2, "width=60%", 5);
table_section(1);
if ($new) {
    customer_list_row(_("From Customer:"), 'customer_id', null, false, true);
} else {
    label_cells(_("From Customer:"), $_POST['customer_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 (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);
}
read_customer_data();
function customer_list($term = '')
{
    global $tpl;
    $term = trim($term);
    $query = "SELECT * FROM `customers`";
    if (!empty($term)) {
        $query .= " WHERE `surname` LIKE '%{$term}%'";
        $query .= " OR `phone` LIKE '%{$term}%'";
        $query .= " OR `address` LIKE '%{$term}%'";
        $query .= " OR `email` LIKE '%{$term}%'";
        $query .= " OR `vat_account` LIKE '%{$term}%'";
    }
    $query .= " ORDER BY `surname` ASC";
    $res = common_query($query, __FILE__, __LINE__);
    if (!$res) {
        return ERR_MYSQL;
    }
    if (!mysql_num_rows($res)) {
        $msg = ucphr('ERR_NO_CUSTOMER_FOUND');
        $msg = '<font color="Red">' . $msg . '</font>';
        $tpl->append('messages', $msg);
        return '';
    }
    $msg .= customer_list_table_head();
    while ($arr = mysql_fetch_array($res)) {
        $msg .= customer_list_row($arr);
    }
    $msg .= customer_list_table_bottom();
    return $msg;
}
Esempio n. 4
0
function display_item_form()
{
    global $table_style2;
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer(false);
    }
    if (!isset($_POST['DateBanked'])) {
        $_POST['DateBanked'] = Today();
        if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
            $_POST['DateBanked'] = end_fiscalyear();
        }
    }
    customer_list_row(tr("From Customer:"), 'customer_id', null, false, true);
    if (db_customer_has_branches($_POST['customer_id'])) {
        customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
    } else {
        hidden('BranchID', reserved_words::get_any_numeric());
    }
    read_customer_data();
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
        echo "</table></table>";
        display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'");
    } else {
        $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
        amount_row(tr("Amount:"), 'amount');
        amount_row(tr("Amount of Discount:"), 'discount');
        label_row(tr("Customer prompt payment discount :"), $display_discount_percent);
        date_row(tr("Date of Deposit:"), 'DateBanked');
        echo "</table>";
        echo "</td><td valign=top class='tableseparator'>";
        // outer table
        echo "<table>";
        bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true);
        $cust_currency = get_customer_currency($_POST['customer_id']);
        $bank_currency = get_bank_account_currency($_POST['bank_account']);
        if ($cust_currency != $bank_currency) {
            exchange_rate_display($cust_currency, $bank_currency, $_POST['DateBanked']);
        }
        bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null);
        text_row(tr("Reference:"), 'ref', null, 20, 40);
        textarea_row(tr("Memo:"), 'memo_', null, 22, 4);
        echo "</table>";
        echo "</td></tr>";
        end_table();
        // outer table
        if ($cust_currency != $bank_currency) {
            display_note(tr("Amount and discount are in customer's currency."));
        }
        echo "<br>";
        submit_center('AddPaymentItem', tr("Add Payment"));
    }
    echo "<br>";
}
 case PT_MISC:
     text_row_ex($payment ? _("To the Order of:") : _("Name:"), 'person_id', 40, 50);
     textarea_row(_("Address:"), 'address', '', 40, 3);
     //moodlearning
     break;
     //case PT_WORKORDER :
     //	workorders_list_row(_("Work Order:"), 'person_id', null);
     //	break;
 //case PT_WORKORDER :
 //	workorders_list_row(_("Work Order:"), 'person_id', null);
 //	break;
 case PT_SUPPLIER:
     supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true);
     break;
 case PT_CUSTOMER:
     customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true);
     if (db_customer_has_branches($_POST['person_id'])) {
         customer_branches_list_row(_("Branch:"), $_POST['person_id'], 'PersonDetailID', null, false, true, true, true);
     } else {
         $_POST['PersonDetailID'] = ANY_NUMERIC;
         hidden('PersonDetailID');
     }
     $trans = get_customer_habit($_POST['person_id']);
     // take care of customers on hold
     if ($trans['dissallow_invoices'] != 0) {
         if ($payment) {
             $customer_error = true;
             display_error(_("This customer account is on hold."));
         } else {
             display_warning(_("This customer account is on hold."));
         }