function ProcessPayment() { $paymentCalcObj = new manage_payment_calculation(); $paymentCalcObj->__YEAR = DateModules::GetYear($_POST["end_date"]); $paymentCalcObj->__MONTH = DateModules::GetMonth($_POST["end_date"]); $paymentCalcObj->__CALC_NORMALIZE_TAX = isset($_POST['tax_normalize']) ? "1" : "0"; $paymentCalcObj->__START_NORMALIZE_TAX_MONTH = $_POST['tax_n_m']; $paymentCalcObj->__START_NORMALIZE_TAX_YEAR = $_POST['tax_normalized_year']; $paymentCalcObj->__BACKPAY_BEGIN_FROM = 1; $paymentCalcObj->__CALC_NEGATIVE_FICHE = isset($_POST['negative_fiche']) ? "1" : "0"; $paymentCalcObj->month_start = DateModules::shamsi_to_miladi($_POST["start_date"]); $paymentCalcObj->month_end = DateModules::shamsi_to_miladi($_POST["end_date"]); $paymentCalcObj->__MONTH_LENGTH = ceil(DateModules::GDateMinusGDate($paymentCalcObj->month_end, $paymentCalcObj->month_start) + 1); $paymentCalcObj->__MSG = $_POST["message"]; // <editor-fold defaultstate="collapsed" desc="Create Where" > $where = "1=1"; $whereParam = array(); if (!empty($_POST["from_staff_id"])) { $where .= " AND s.staff_id >= :fsid"; $whereParam[":fsid"] = $_POST["from_staff_id"]; } if (!empty($_POST["to_staff_id"])) { $where .= " AND s.staff_id <= :tsid"; $whereParam[":tsid"] = $_POST["to_staff_id"]; } // </editor-fold> $paymentCalcObj->__WHERE = $where; $paymentCalcObj->__WHEREPARAM = $whereParam; if (isset($_POST["compute_backpay"])) { $res = $paymentCalcObj->run_back(); } else { $res = $paymentCalcObj->run(); } if (!$res) { echo Response::createObjectiveResponse(false, ExceptionHandler::popExceptionDescription()); die; } else { echo Response::createObjectiveResponse(true, $paymentCalcObj->success_counter . "_" . $paymentCalcObj->fail_counter); die; } }
function selectArrearTransferWrits() { MakeAdvanceSearchWhere($where, $whereParam); $state; $state = isset($_REQUEST["return"]) ? "1" : "0"; $stateWhere = ""; $stateWhere = " w.arrear = " . $state . " AND "; $curYear = DateModules::GetYear(DateModules::miladi_to_shamsi(DateModules::Now())); $query = "select w.writ_id,\n w.writ_ver,\n w.staff_id,\n w.ouid,\n w.issue_date,\n w.history_only,\n w.corrective,\n w.execute_date,\n concat(wt.title,' - ', wst.title) as wt_title,\n bi_emp_state.title as emp_state_title,\n w.ref_letter_no,\n w.ref_letter_date,\n w.person_type,\n concat(p.pfname, ' ', p.plname) fullname,\n w.corrective_writ_id,\n w.correct_completed,\n\t\t\t\t\t w.view_flag\n\t\t\t\t\n\t\t\t\tfrom staff s\n \n \t\t LEFT OUTER JOIN writs w ON (w.staff_id = s.staff_id)\n LEFT OUTER JOIN writ_types wt ON ((w.writ_type_id = wt.writ_type_id) AND (w.person_type = wt.person_type))\n LEFT OUTER JOIN writ_subtypes wst ON (w.writ_subtype_id = wst.writ_subtype_id AND w.writ_type_id = wst.writ_type_id \n \t\t\t\t\t\t\t\t\t\t\tAND w.person_type = wst.person_type)\n LEFT OUTER JOIN persons p ON (s.PersonID = p.PersonID)\n LEFT OUTER JOIN org_new_units o ON (w.ouid = o.ouid)\n LEFT JOIN Basic_Info bi_emp_state on(bi_emp_state.TypeID=3 and w.emp_state=bi_emp_state.InfoID)\n LEFT JOIN payment_writs pw ON pw.writ_id = w.writ_id and pw.writ_ver = w.writ_ver and pw.staff_id = w.staff_id \n\t\t\t\t \n\t\t\twhere w.execute_date >= '" . TRANSFER_WRIT_EXE_DATE . "' AND w.state = 3 AND \n\t\t\t\t w.execute_date < '" . str_replace("/", "-", DateModules::shamsi_to_miladi($curYear . "/01/01")) . "' AND\t\t\t\t \n\t\t\t\t substr(g2j(w.execute_date),1,4) < substr(g2j(writ_recieve_date),1,4) AND \n\t\t\t\t {$stateWhere}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n s.person_type in (" . manage_access::getValidPersonTypes() . ") AND w.cost_center_id in (" . manage_access::getValidCostCenters() . ") AND\n\t\t\t\tw.emp_state <> 0 AND\n\t\t\t\t(w.history_only=0 OR w.history_only IS NULL) AND \n\t\t\t\t(w.dont_transfer = 0 OR w.dont_transfer IS NULL) AND\n ( pw.writ_id is null ) AND\n\t\t\t\t(w.correct_completed!=" . WRIT_CORRECTING . ") AND " . $where . "\n\t\t\t\n\t\t\torder by p.plname,p.pfname,s.staff_id,w.execute_date,w.writ_id,w.writ_ver"; $temp = PdoDataAccess::runquery($query, $whereParam); /*if($_SESSION['UserID'] == 'jafarkhani') { echo PdoDataAccess::GetLatestQueryString(); die(); }*/ for ($i = 0; $i < count($temp); $i++) { $temp[$i]['full_unit_title'] = manage_units::get_full_title($temp[$i]['ouid']); } echo dataReader::getJsonData($temp, count($temp), $_GET["callback"]); die; }
static function IsEditable($row_no) { $dt = PdoDataAccess::runquery("select * from person_subtracts join person_subtract_flows using(subtract_id) where row_no=?", array($row_no)); if ($dt[0]["IsFinished"] == "1") { return false; } $subtract_id = $dt[0]["subtract_id"]; $flow_date = DateModules::miladi_to_shamsi($dt[0]["flow_date"]); $year = DateModules::GetYear($flow_date); $month = DateModules::GetMonth($flow_date); $dt = PdoDataAccess::runquery("select * from payment_items join payments using(payment_type,staff_id,pay_year,pay_month)\n\t\t\t\twhere param1 in('LOAN','FIX_FRACTION','FIX_BENEFIT')\n\t\t\t\t\tAND param2 = {$subtract_id} \n\t\t\t\t\tAND pay_year>={$year} \n\t\t\t\t\tAND if(pay_year={$year}, pay_month>={$month}, 1=1) \n\t\t\t\t\tAND\tif(pay_year={$year} AND pay_month={$month}, calc_date > '" . $dt[0]["flow_date"] . "', 1=1)"); if (count($dt) > 0) { return false; } return true; }