function AddBuyingAct($arr) { global $error; $object_id = $arr['o_obj']; $result = mysql_query("INSERT INTO `overhead`\n\t\t\t\t\t\t\t(`id`, `stream`, `status`, `waybill_number`, `activate_date`, `is_confirmed`, `confirmation_date`) \n\t\t\t\t\t\t VALUES\n\t\t\t\t\t\t\t({$arr['lid']}, 2, {$arr['status']}, '{$arr['d_number']}', '{$arr['activate_date']}', 2, '{$arr['activate_date']}')"); $id = mysql_insert_id(); $full_amount = GetFullAmount($id); if (!$result) { $error = 'Invalid query: ' . mysql_error() . '\\n'; } else { //Saller $result = mysql_query("UPDATE\n\t\t\t\t\t \t\t\t`overhead`\n\t\t\t\t\t\t\t SET\n\t\t\t\t\t\t\t\t `seller_tin`\t= '{$arr['seller_tin']}',\n\t\t\t\t\t\t\t\t `seller_name`\t= '{$arr['seller_name']}',\n\t\t\t\t\t\t\t\t `full_amount`\t= '{$full_amount}'\n\t\t\t\t\t\t\t WHERE\n\t\t\t\t\t\t\t\t\t`id` = {$id}"); if (!$result) { $error .= 'Invalid query: ' . mysql_error() . '\\n'; } //AddHistory($id, $object_id); AddReserve($id, $object_id); return $id; } }
$arr = array("o_obj" => $_REQUEST['obj'], "o_type" => $_REQUEST['ot'], "o_number" => $_REQUEST['on'], "actation_data" => $_REQUEST['ad'], "local_par_id" => $_REQUEST['pi'], "transport_type" => $_REQUEST['tt'], "driver_id" => $_REQUEST['di'], "driver_name" => $_REQUEST['dn'], "auto_number" => $_REQUEST['an'], "auto_trailer" => $_REQUEST['at'], "auto_expence_n" => $_REQUEST['aen'], "auto_expence" => $_REQUEST['ae'], "buyer_tin" => $_REQUEST['bin'], "buyer_name" => $_REQUEST['bn'], "buyer_addree" => $_REQUEST['ba']); if (empty($overhead_id)) { $id = AddOverhead($user_id, $arr); $data = array('overhead_id' => $id); } else { $data = array('overhead_id' => $overhead_id); } break; case 'disable': $overhead_id = $_REQUEST['id']; DeleteOverhead($overhead_id); break; case 'add_reserve': $overhead_id = $_REQUEST['id']; $object = $_REQUEST['obj']; AddReserve($overhead_id, $object); break; case 'add_partner_acc': $overhead_id = $_REQUEST['id']; $partner_id = GetPartnerID($_REQUEST['bin']); $arr = array("method" => $_REQUEST['pm'], "nided" => $_REQUEST['pn'], "payed" => $_REQUEST['p'], "needed_date" => $_REQUEST['pnd'], "type" => $_REQUEST['type']); AddPartnerAcc($overhead_id, $partner_id, $arr); break; case 'check_identity': $overhead_id = $_REQUEST['id']; $check = ChackGoodsIdentity($overhead_id); if (!$check) { $error = '1 - მოახდინეთ ყველა პროდუქტის იდენტიფიკაცია!'; } else { $check = ChackOverheadIdentity($overhead_id); if (!$check) {
function AddBuyingAct($arr) { global $error; $object_id = $arr['o_obj']; $result = mysql_query("INSERT INTO `overhead`\n\t\t\t\t\t\t\t(`id`, `payed` ,`stream`, `status`, `waybill_number`, `activate_date`, `is_confirmed`, `confirmation_date`) \n\t\t\t\t\t\t VALUES\n\t\t\t\t\t\t\t({$arr['lid']}, '{$_REQUEST['payed']}', 2, {$arr['status']}, '{$arr['d_number']}', '{$arr['activate_date']}', 2, '{$arr['activate_date']}')"); $id = mysql_insert_id(); mysql_query("INSERT INTO `cash_flow` \n\t (`date`,`partner_id`, `doc_type_id`, `doc_id`, `opertaion_type`, `cash`, `amount`,\n\t `balans`) \n\t VALUES (NOW(),'{$arr['seller_tin']}', 'შეძენის აქტი', '{$id}', 'შესყიდვა', {$_REQUEST['payed']} ,{$_REQUEST['pay_nided']},\n\t IFNULL((SELECT balans FROM cash_flow as cash_flow1 WHERE cash_flow1.partner_id='{$arr['seller_tin']}' ORDER BY cash_flow1.id DESC limit 1),0.00)+{$_REQUEST['payed']}-{$_REQUEST['pay_nided']}\n\t )"); $full_amount = GetFullAmount($id); if (!$result) { $error = 'Invalid query1: ' . mysql_error() . '\\n'; } else { //Saller $result = mysql_query("UPDATE\n\t\t\t\t\t \t\t\t`overhead`\n\t\t\t\t\t\t\t SET\n\t\t\t\t\t\t\t\t `seller_tin`\t= '{$arr['seller_tin']}',\n\t\t\t\t\t\t\t\t `seller_name`\t= '{$arr['seller_name']}',\n\t\t\t\t\t\t\t\t `full_amount`\t= '{$full_amount}'\n\t\t\t\t\t\t\t WHERE\n\t\t\t\t\t\t\t\t\t`id` = {$id}"); if (!$result) { $error .= 'Invalid query: ' . mysql_error() . '\\n'; } //AddHistory($id, $object_id); AddReserve($id, $object_id); return $id; } }