Esempio n. 1
0
function edit_link($row)
{
    global $editors;
    $ok = true;
    if ($row['type'] == ST_SALESINVOICE) {
        $myrow = get_customer_trans($row["type_no"], $row["type"]);
        if ($myrow['alloc'] != 0 || get_voided_entry(ST_SALESINVOICE, $row["type_no"]) !== false) {
            $ok = false;
        }
    }
    return isset($editors[$row["type"]]) && !is_closed_trans($row["type"], $row["type_no"]) && $ok ? pager_link(_("Edit"), sprintf($editors[$row["type"]], $row["type_no"], $row["type"]), ICON_EDIT) : '';
}
Esempio n. 2
0
function handle_void_transaction()
{
    if (check_valid_entries() == true) {
        $void_entry = get_voided_entry($_POST['filterType'], $_POST['trans_no']);
        if ($void_entry != null) {
            display_error(tr("The selected transaction has already been voided."), true);
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
            set_focus('trans_no');
            return;
        }
        $ret = void_transaction($_POST['filterType'], $_POST['trans_no'], $_POST['date_'], $_POST['memo_']);
        if ($ret) {
            display_notification_centered(tr("Selected transaction has been voided."));
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
        } else {
            display_error(tr("The entered transaction does not exist or cannot be voided."));
            set_focus('trans_no');
        }
    }
}
function edit_link($row)
{
    if (@$_GET['popup'] || get_voided_entry($row['type'], $row["trans_no"]) || is_closed_trans($row['type'], $row["trans_no"])) {
        return '';
    }
    $str = '';
    switch ($row['type']) {
        case ST_SALESINVOICE:
            $str = "/sales/customer_invoice.php?ModifyInvoice=" . $row['trans_no'];
            break;
        case ST_CUSTCREDIT:
            if ($row['order_'] == 0) {
                // free-hand credit note
                $str = "/sales/credit_note_entry.php?ModifyCredit=" . $row['trans_no'];
            } else {
                // credit invoice
                $str = "/sales/customer_credit_invoice.php?ModifyCredit=" . $row['trans_no'];
            }
            break;
        case ST_CUSTDELIVERY:
            $str = "/sales/customer_delivery.php?ModifyDelivery=" . $row['trans_no'];
            break;
        case ST_CUSTPAYMENT:
            $str = "/sales/customer_payments.php?trans_no=" . $row['trans_no'];
            break;
    }
    return $str ? pager_link(_('Edit'), $str, ICON_EDIT) : '';
}
Esempio n. 4
0
function edit_link($row)
{
    $str = '';
    if (@$_GET['popup']) {
        return '';
    }
    switch ($row['type']) {
        case ST_SALESINVOICE:
            if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0) {
                $str = "/sales/customer_invoice.php?ModifyInvoice=" . $row['trans_no'];
            }
            break;
        case ST_CUSTCREDIT:
            if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) {
                if ($row['order_'] == 0) {
                    // free-hand credit note
                    $str = "/sales/credit_note_entry.php?ModifyCredit=" . $row['trans_no'];
                } else {
                    // credit invoice
                    $str = "/sales/customer_credit_invoice.php?ModifyCredit=" . $row['trans_no'];
                }
            }
            break;
        case ST_CUSTDELIVERY:
            if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false) {
                $str = "/sales/customer_delivery.php?ModifyDelivery=" . $row['trans_no'];
            }
            break;
        case ST_CUSTPAYMENT:
            if (get_voided_entry(ST_CUSTPAYMENT, $row["trans_no"]) === false) {
                $str = "/sales/customer_payments.php?trans_no=" . $row['trans_no'];
            }
            break;
    }
    if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"])) {
        return pager_link(_('Edit'), $str, ICON_EDIT);
    }
    return '';
}