function can_process() { global $wo_details; if (!check_num('costs', 0)) { display_error(_("The amount entered is not a valid number or less then zero.")); set_focus('costs'); return false; } if (!is_date($_POST['date_'])) { display_error(_("The entered date is invalid.")); set_focus('date_'); return false; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('date_'); return false; } if (date_diff2(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) { display_error(_("The additional cost date cannot be before the release date of the work order.")); set_focus('date_'); return false; } return true; }
function check_overdue($row) { return !$row["closed"] && date_diff2(Today(), sql2date($row["required_by"]), "d") > 0; }
function can_process() { global $wo_details, $SysPrefs, $Refs; if (!$Refs->is_valid($_POST['ref'])) { display_error(_("You must enter a reference.")); set_focus('ref'); return false; } if (!is_new_reference($_POST['ref'], 29)) { display_error(_("The entered reference is already in use.")); set_focus('ref'); return false; } if (!check_num('quantity', 0)) { display_error(_("The quantity entered is not a valid number or less then zero.")); set_focus('quantity'); return false; } if (!is_date($_POST['date_'])) { display_error(_("The entered date is invalid.")); set_focus('date_'); return false; } elseif (!is_date_in_fiscalyear($_POST['date_'])) { display_error(_("The entered date is not in fiscal year.")); set_focus('date_'); return false; } if (date_diff2(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) { display_error(_("The production date cannot be before the release date of the work order.")); set_focus('date_'); return false; } // don't produce more that required. Otherwise change the Work Order. if (input_num('quantity') > $wo_details["units_reqd"] - $wo_details["units_issued"]) { display_error(_("The production exceeds the quantity needed. Please change the Work Order.")); set_focus('quantity'); return false; } // if unassembling we need to check the qoh if ($_POST['ProductionType'] == 0 && !$SysPrefs->allow_negative_stock()) { $wo_details = get_work_order($_POST['selected_id']); $qoh = get_qoh_on_date($wo_details["stock_id"], $wo_details["loc_code"], $_POST['date_']); if (-input_num('quantity') + $qoh < 0) { display_error(_("The unassembling cannot be processed because there is insufficient stock.")); set_focus('quantity'); return false; } } // if production we need to check the qoh of the wo requirements if ($_POST['ProductionType'] == 1 && !$SysPrefs->allow_negative_stock()) { $err = false; $result = get_wo_requirements($_POST['selected_id']); while ($row = db_fetch($result)) { if ($row['mb_flag'] == 'D') { // service, non stock continue; } $qoh = get_qoh_on_date($row["stock_id"], $row["loc_code"], $_POST['date_']); if ($qoh - $row['units_req'] * input_num('quantity') < 0) { display_error(_("The production cannot be processed because a required item would cause a negative inventory balance :") . " " . $row['stock_id'] . " - " . $row['description']); $err = true; } } if ($err) { set_focus('quantity'); return false; } } return true; }
function is_overdue($row) { return date_diff2(Today(), sql2date($row["due_date"]), "d") > 0; }
function lignSearchExercices($cr1, $cr2, $cr3, $cr4) { $ret = ''; $table1 = "stocks_exercice"; //Connection to Database server mysql_connect(DBSERVER, DBUSER, DBPWD) or header('location:errorPage.php&code='); //Select Database mysql_select_db(DB) or header('location:errorPage.php&code='); //SQL $where = ''; isset($cr1) and $cr1 != '' ? $where .= " ID_EXERCICE = '{$cr1}' AND " : ($where .= ""); isset($cr2) and $cr2 != '' ? $where .= " LIBELLE_EXERCICE LIKE '%{$cr2}%' AND " : ($where .= ""); isset($cr3) and $cr3 != '' ? $where .= " DEBUT = '" . mysqlFormat($cr3) . "' AND " : ($where .= ""); isset($cr4) and $cr4 != '' ? $where .= " FIN = '" . mysqlFormat($cr4) . "' AND " : ($where .= ""); if ($where != '') { $where = substr(" WHERE {$where}", 0, strlen(" WHERE {$where}") - 4); } $order = ''; isset($ord) and $ord != '' ? $order = " ORDER BY {$ord} {$sens}" : ($order = " ORDER BY {$table1}.ID_EXERCICE ASC"); $SQL = "SELECT * FROM {$table1} {$where} {$order};"; $result = mysql_query($SQL); $i = 0; $j = 5; while ($row = mysql_fetch_array($result)) { $i % 2 == 0 ? $col = "tableOddRow" : ($col = "tableEvenRow"); $row['STATUS'] == '0' ? $status = 'Non clôturé' : ($status = 'Clôturé'); $row['FIN'] >= date('Y-m-d') ? $tps = '(jj-' . date_diff2(date('Y-m-d'), $row['FIN']) . ')' : ($tps = ''); $ret .= '<tr align="left" valign="middle" class="' . $col . '"> <td width="3%"><input type="checkbox" name="rowSelection[]" value="' . $row['ID_EXERCICE'] . '" onClick="go(' . $row['ID_EXERCICE'] . ',' . $j . ');"></td> <td width="6%" height="22" class="text" align="center">' . $row['ID_EXERCICE'] . '</td> <td width="30%" class="text" >' . stripslashes($row['LIBELLE_EXERCICE']) . '</td> <td width="20%" class="text" align="center">' . frFormat($row['DEBUT']) . '</td> <td width="20%" class="text" align="center">' . frFormat($row['FIN']) . '</td> <td width="20%" class="text" align="center">' . $status . ' <font color="#066">' . $tps . '</font></td> </tr>'; $i++; $j++; } //mysql_close); return $ret; }