Пример #1
0
function check_data()
{
    global $Refs, $SysPrefs;
    /*--------------------MOODLEARNING---------------------------*/
    if (!get_post('custom_num')) {
        display_error(_("There is no delivery number entered."));
        set_focus('custom_num');
        return false;
    }
    /*--------------------------------------------------------------------*/
    if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
        display_error(_("The entered date of delivery is invalid."));
        set_focus('DispatchDate');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
        display_error(_("The entered date of delivery is not in fiscal year."));
        set_focus('DispatchDate');
        return false;
    }
    if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        display_error(_("The entered dead-line for invoice is invalid."));
        set_focus('due_date');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!$Refs->is_valid($_POST['ref'])) {
            display_error(_("You must enter a reference."));
            set_focus('ref');
            return false;
        }
    }
    if ($_POST['ChargeFreightCost'] == "") {
        $_POST['ChargeFreightCost'] = price_format(0);
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(_("The entered shipping value is not numeric."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if ($_SESSION['Items']->has_items_dispatch() == 0 && input_num('ChargeFreightCost') == 0) {
        display_error(_("There are no item quantities on this delivery note."));
        return false;
    }
    if (!check_quantities()) {
        return false;
    }
    copy_to_cart();
    if (!$SysPrefs->allow_negative_stock() && ($low_stock = $_SESSION['Items']->check_qoh())) {
        display_error(_("This document cannot be processed because there is insufficient quantity for: ") . implode(',', $low_stock));
        return false;
    }
    return true;
}
function can_process()
{
    global $Refs;
    /*===================MOODLEARNING===========================*/
    if (!get_post('custom_num')) {
        display_error(_("You must enter a Credit Memo No."));
        set_focus('custom_num');
        return false;
    }
    if (!is_numeric($_POST['custom_num'])) {
        display_error(_("The Credit Memo # contains invalid characters. Please check again."));
        set_focus('custom_num');
        return false;
    }
    /*==========================================================*/
    if (!is_date($_POST['CreditDate'])) {
        display_error(_("The entered date is invalid."));
        set_focus('CreditDate');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('CreditDate');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!$Refs->is_valid($_POST['ref'])) {
            display_error(_("You must enter a reference."));
            set_focus('ref');
            return false;
        }
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(_("The entered shipping cost is invalid or less than zero."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if (!check_quantities()) {
        display_error(_("Selected quantity cannot be less than zero nor more than quantity not credited yet."));
        return false;
    }
    return true;
}
Пример #3
0
function check_data()
{
    global $Refs;
    if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) {
        display_error(_("The entered invoice date is invalid."));
        set_focus('InvoiceDate');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) {
        display_error(_("The entered invoice date is not in fiscal year."));
        set_focus('InvoiceDate');
        return false;
    }
    if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        display_error(_("The entered invoice due date is invalid."));
        set_focus('due_date');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!$Refs->is_valid($_POST['ref'])) {
            display_error(_("You must enter a reference."));
            set_focus('ref');
            return false;
        }
    }
    if ($_POST['ChargeFreightCost'] == "") {
        $_POST['ChargeFreightCost'] = price_format(0);
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(_("The entered shipping value is not numeric."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if ($_SESSION['Items']->has_items_dispatch() == 0 && input_num('ChargeFreightCost') == 0) {
        display_error(_("There are no item quantities on this invoice."));
        return false;
    }
    if (!check_quantities()) {
        display_error(_("Selected quantity cannot be less than quantity credited nor more than quantity not invoiced yet."));
        return false;
    }
    return true;
}
function check_data()
{
    global $Refs;
    if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
        display_error(_("The entered date of delivery is invalid."));
        set_focus('DispatchDate');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
        display_error(_("The entered date of delivery is not in fiscal year."));
        set_focus('DispatchDate');
        return false;
    }
    if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        display_error(_("The entered dead-line for invoice is invalid."));
        set_focus('due_date');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!$Refs->is_valid($_POST['ref'])) {
            display_error(_("You must enter a reference."));
            set_focus('ref');
            return false;
        }
    }
    if ($_POST['ChargeFreightCost'] == "") {
        $_POST['ChargeFreightCost'] = price_format(0);
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(_("The entered shipping value is not numeric."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if ($_SESSION['Items']->has_items_dispatch() == 0 && input_num('ChargeFreightCost') == 0) {
        display_error(_("There are no item quantities on this delivery note."));
        return false;
    }
    if (!check_quantities()) {
        return false;
    }
    return true;
}
Пример #5
0
function can_process()
{
    global $Refs;
    if (!is_date($_POST['CreditDate'])) {
        display_error(_("The entered date is invalid."));
        set_focus('CreditDate');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) {
        display_error(_("The entered date is not in fiscal year."));
        set_focus('CreditDate');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!$Refs->is_valid($_POST['ref'])) {
            display_error(_("You must enter a reference."));
            set_focus('ref');
            return false;
        }
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(_("The entered shipping cost is invalid or less than zero."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if (!check_quantities()) {
        display_error(_("Selected quantity cannot be less than zero nor more than quantity not credited yet."));
        return false;
    }
    return true;
}
Пример #6
0
function check_data()
{
    if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
        display_error(tr("The entered date of delivery is invalid."));
        set_focus('DispatchDate');
        return false;
    }
    if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
        display_error(tr("The entered date of delivery is not in fiscal year."));
        set_focus('DispatchDate');
        return false;
    }
    if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) {
        display_error(tr("The entered dead-line for invoice is invalid."));
        set_focus('due_date');
        return false;
    }
    if ($_SESSION['Items']->trans_no == 0) {
        if (!references::is_valid($_POST['ref'])) {
            display_error(tr("You must enter a reference."));
            set_focus('ref');
            return false;
        }
        if ($_SESSION['Items']->trans_no == 0 && !is_new_reference($_POST['ref'], 13)) {
            display_error(tr("The entered reference is already in use."));
            set_focus('ref');
            return false;
        }
    }
    if ($_POST['ChargeFreightCost'] == "") {
        $_POST['ChargeFreightCost'] = price_format(0);
    }
    if (!check_num('ChargeFreightCost', 0)) {
        display_error(tr("The entered shipping value is not numeric."));
        set_focus('ChargeFreightCost');
        return false;
    }
    if ($_SESSION['Items']->has_items_dispatch() == 0 && input_num('ChargeFreightCost') == 0) {
        display_error(tr("There are no item quantities on this delivery note."));
        return false;
    }
    if (!check_quantities()) {
        display_error(tr("Selected quantity cannot be less than quantity invoiced nor more than quantity\n\t\tnot dispatched on sales order."));
        return false;
    }
    return true;
}