Beispiel #1
0
 function submitNamsari()
 {
     if (!F3::get('SESSION.onlineUser')) {
         F3::reroute("/");
     }
     $vehicle = F3::get("PARAMS.trans");
     $sql = DB::SQL("select vehicleid from vehicle where id=111");
     $wheeler = F3::get("POST.wheeler");
     $zone_id = F3::get("POST.zone_id");
     $lot_number = F3::get("POST.lot_number");
     $vehicle_symbol_type = $wheeler == 21 ? F3::get("POST.vehicle_symbol_type_two") : F3::get("POST.vehicle_symbol_type_four");
     $number = F3::get("POST.number");
     $user = new User();
     $vehicleid = $user->vehicleid($wheeler, $zone_id, $lot_number, $vehicle_symbol_type, $number);
     //table namsari
     $reason = F3::get("POST.reason");
     $date = F3::get("POST.date");
     $remarks = F3::get("POST.remarks");
     $witness_name = F3::get("POST.witness_name");
     $witness_address = F3::get("POST.witness_address");
     $citizenship_no = F3::get("POST.citizenship_no");
     //owner table
     $owner_type = F3::get("POST.owner_type");
     $first_name = F3::get("POST.first_name");
     $last_name = F3::get("POST.last_name");
     $father_name = F3::get("POST.father_name");
     $grandfather_name = F3::get("POST.grandfather_name");
     $dob = F3::get("POST.dob");
     $email = F3::get("POST.email");
     $mobile = F3::get("POST.mobileno");
     $p_zone_id = F3::get("POST.p_zone_id");
     $p_district_id = F3::get("POST.p_district_id");
     $p_metropolitan = F3::get("POST.p_metropolitan");
     $p_ward_no = F3::get("POST.p_ward_no");
     $p_address = F3::get("POST.p_address");
     $p_house_no = F3::get("POST.p_house_no");
     $p_phone = F3::get("POST.p_phone");
     $temp_zone_id = F3::get("POST.temp_zone_id");
     $temp_district_id = F3::get("POST.temp_district_id");
     $temp_metropolitan = F3::get("POST.temp_metropolitan");
     $temp_ward_no = F3::get("POST.temp_ward_no");
     $temp_address = F3::get("POST.temp_address");
     $temp_house_no = F3::get("POST.temp_house_no");
     $temp_phone = F3::get("POST.temp_phone");
     $nabalik_guardian_name = F3::get("POST.nabalik_guardian_name");
     $nabalik_relation = F3::get("POST.nabalik_relation");
     $nabalik_identity_no = F3::get("POST.nabalik_identity_no");
     $nabalik_district = F3::get("POST.nabalik_district");
     $nabalik_year = F3::get("POST.nabalik_year");
     $nabalik_address = F3::get("POST.nabalik_address");
     $bank_name = F3::get("POST.bank_name");
     $creditor_name = F3::get("POST.creditor_name");
     $creditor_district = F3::get("POST.creditor_district");
     $creditor_year = F3::get("POST.creditor_year");
     $creditor_address = F3::get("POST.creditor_address");
     $per_nagarikta = F3::get("POST.per_nagarikta");
     $per_identificationno = F3::get("POST.per_identificationno");
     $per_district = F3::get("POST.per_district");
     $per_year = F3::get("POST.per_year");
     $captcha = F3::get("POST.code");
     if ($captcha == F3::get("SESSION.captcha")) {
         $data = new User();
         $picture = $data->pictureFolder($vehicle);
         $onlineSql[] = "update vehicle set wheeler='{$wheeler}',vehicleid='{$vehicleid}',zone_id='{$zone_id}',lot_number='{$lot_number}',\n        vehicle_symbol_type='{$vehicle_symbol_type}', number='{$number}', status='pending'  where id='" . $vehicle . "'";
         $onlineSql[] = "update namsari set reason='{$reason}',date='{$date}',remarks='{$remarks}',witness_name='{$witness_name}',witness_address='{$witness_address}',citizenship_no='{$citizenship_no}'where id='" . $vehicle . "'";
         $onlineSql[] = "update owner set owner_type='{$owner_type}',first_name='{$first_name}',last_name='{$last_name}', father_name='{$father_name}',\n        grandfather_name='{$grandfather_name}',dob='{$dob}',email='{$email}',mobileno='{$mobile}',p_zone_id='{$p_zone_id}',p_district_id='{$p_district_id}',\n        p_metropolitan='{$p_metropolitan}',p_ward_no='{$p_ward_no}',p_address='{$p_address}', p_house_no='{$p_house_no}', p_phone='{$p_phone}',\n        temp_zone_id='{$temp_zone_id}',temp_district_id='{$temp_district_id}', temp_metropolitan='{$temp_metropolitan}', temp_ward_no='{$temp_ward_no}', temp_address='{$temp_address}',temp_house_no='{$temp_house_no}',\n        temp_phone='{$temp_phone}', nabalik_guardian_name='{$nabalik_guardian_name}',nabalik_relation='{$nabalik_relation}',\n        nabalik_identity_no='{$nabalik_identity_no}', nabalik_district='{$nabalik_district}', nabalik_year='{$nabalik_year}', nabalik_address='{$nabalik_address}',\n        bank_name='{$bank_name}', creditor_name='{$creditor_name}',\n        creditor_district='{$creditor_district}', creditor_year='{$creditor_year}', creditor_address='{$creditor_address}',per_nagarikta='{$per_nagarikta}',\n        per_identificationno='{$per_identificationno}',per_district='{$per_district}',per_year='{$per_year}' where vehicleid='" . $vehicle . "'";
         DB::SQL($onlineSql);
         F3::reroute("/feedbackt/{$vehicle}");
     } else {
         F3::set('error', 'The captcha  you have entered is wrong');
         $this->getSavedRegistration();
     }
 }
Beispiel #2
0
 function approveNamsari()
 {
     if (!F3::get('SESSION.asid')) {
         F3::reroute("/admin");
     }
     $vehicle = F3::get("PARAMS.id");
     $sql = DB::SQL("select vehicleid from vehicle where id=111");
     $wheeler = F3::get("POST.wheeler");
     $zone_id = F3::get("POST.zone_id");
     $lot_number = F3::get("POST.lot_number");
     $vehicle_symbol_type = $wheeler == 21 ? F3::get("POST.vehicle_symbol_type_two") : F3::get("POST.vehicle_symbol_type_four");
     $number = F3::get("POST.number");
     $user = new User();
     $vehicleid = $user->vehicleid($wheeler, $zone_id, $lot_number, $vehicle_symbol_type, $number);
     //table namsari
     $reason = F3::get("POST.reason");
     $date = F3::get("POST.date");
     $remarks = F3::get("POST.remarks");
     $witness_name = F3::get("POST.witness_name");
     $witness_address = F3::get("POST.witness_address");
     $citizenship_no = F3::get("POST.citizenship_no");
     //owner table
     $owner_type = F3::get("POST.owner_type");
     $first_name = F3::get("POST.first_name");
     $last_name = F3::get("POST.last_name");
     $father_name = F3::get("POST.father_name");
     $grandfather_name = F3::get("POST.grandfather_name");
     $dob = F3::get("POST.dob");
     $reg_num = F3::get("POST.reg_num");
     $email = F3::get("POST.email");
     $mobile = F3::get("POST.mobileno");
     $p_zone_id = F3::get("POST.p_zone_id");
     $p_district_id = F3::get("POST.p_district_id");
     $p_metropolitan = F3::get("POST.p_metropolitan");
     $p_ward_no = F3::get("POST.p_ward_no");
     $p_address = F3::get("POST.p_address");
     $p_house_no = F3::get("POST.p_house_no");
     $p_phone = F3::get("POST.p_phone");
     $temp_zone_id = F3::get("POST.temp_zone_id");
     $temp_district_id = F3::get("POST.temp_district_id");
     $temp_metropolitan = F3::get("POST.temp_metropolitan");
     $temp_ward_no = F3::get("POST.temp_ward_no");
     $temp_address = F3::get("POST.temp_address");
     $temp_house_no = F3::get("POST.temp_house_no");
     $temp_phone = F3::get("POST.temp_phone");
     $nabalik_guardian_name = F3::get("POST.nabalik_guardian_name");
     $nabalik_relation = F3::get("POST.nabalik_relation");
     $nabalik_identity_no = F3::get("POST.nabalik_identity_no");
     $nabalik_district = F3::get("POST.nabalik_district");
     $nabalik_year = F3::get("POST.nabalik_year");
     $nabalik_address = F3::get("POST.nabalik_address");
     $bank_name = F3::get("POST.bank_name");
     $creditor_name = F3::get("POST.creditor_name");
     $creditor_district = F3::get("POST.creditor_district");
     $creditor_year = F3::get("POST.creditor_year");
     $creditor_address = F3::get("POST.creditor_address");
     $per_nagarikta = F3::get("POST.per_nagarikta");
     $per_identificationno = F3::get("POST.per_identificationno");
     $per_district = F3::get("POST.per_district");
     $per_year = F3::get("POST.per_year");
     $indian_identificationno = F3::get("POST.indian_identificationno");
     $other_identificationno = F3::get("POST.other_identificationno");
     //online edit by the operator
     $onlineSql[] = "update vehicle set wheeler='{$wheeler}',vehicleid='{$vehicleid}',zone_id='{$zone_id}',lot_number='{$lot_number}',\n        vehicle_symbol_type='{$vehicle_symbol_type}', number='{$number}', status='approved'  where id='" . $vehicle . "'";
     $onlineSql[] = "update namsari set reason='{$reason}',date='{$date}',remarks='{$remarks}',witness_name='{$witness_name}',witness_address='{$witness_address}',citizenship_no='{$citizenship_no}'where id='" . $vehicle . "'";
     $onlineSql[] = "update owner set owner_type='{$owner_type}',first_name='{$first_name}',last_name='{$last_name}', father_name='{$father_name}',\n        grandfather_name='{$grandfather_name}',dob='{$dob}',reg_num='{$reg_num}',email='{$email}',mobileno='{$mobile}',p_zone_id='{$p_zone_id}',p_district_id='{$p_district_id}',\n        p_metropolitan='{$p_metropolitan}',p_ward_no='{$p_ward_no}',p_address='{$p_address}', p_house_no='{$p_house_no}', p_phone='{$p_phone}',\n        temp_zone_id='{$temp_zone_id}',temp_district_id='{$temp_district_id}', temp_metropolitan='{$temp_metropolitan}', temp_ward_no='{$temp_ward_no}', temp_address='{$temp_address}',temp_house_no='{$temp_house_no}',\n        temp_phone='{$temp_phone}', nabalik_guardian_name='{$nabalik_guardian_name}',nabalik_relation='{$nabalik_relation}',\n        nabalik_identity_no='{$nabalik_identity_no}', nabalik_district='{$nabalik_district}', nabalik_year='{$nabalik_year}', nabalik_address='{$nabalik_address}',\n        bank_name='{$bank_name}', creditor_name='{$creditor_name}',\n        creditor_district='{$creditor_district}', creditor_year='{$creditor_year}', creditor_address='{$creditor_address}',per_nagarikta='{$per_nagarikta}',\n        per_identificationno='{$per_identificationno}',per_district='{$per_district}',per_year='{$per_year}',indian_identificationno='{$indian_identificationno}' ,other_identificationno='{$other_identificationno}' where vehicleid='" . $vehicle . "'";
     //
     //
     $zone = Admin::getZone($zone_id);
     $symbol = Admin::getSymbolType($vehicle_symbol_type);
     $vehicleNo = $zone . $lot_number . $symbol . $number;
     F3::set('DB', new DB(F3::get("db_param.live_host"), F3::get("db_param.live_user"), F3::get("db_param.live_password")));
     $old_owner_id = DB::sql("select owner_id from vehicle where id='" . $vehicleid . "'");
     //check whether id is int
     if (count($old_owner_id) > 0) {
         $sqls[] = "INSERT INTO owner\n        (name,caste,dob,email,owner_type_id,father_name,g_father_name,mobileno,p_district,p_zone_id,\n        p_nagarpalika,p_wardno, p_tole,p_gharno,p_phone,t_district,t_zone_id,t_nagarpalika,t_wardno,t_tole,\n        t_gharno,t_phone,nab_guardian_name,nab_relation,nab_identificationno,nab_district,nab_year,nab_address,per_nagarikta, per_identificationno,\n        per_district,per_year,bank_name,bank_identificationno,bank_district, bank_year,bank_address) VALUES\n        ('{$first_name}', '{$last_name}','{$dob}','{$email}','{$owner_type}','{$father_name}','{$grandfather_name}', '{$mobile}',' {$p_district_id}',' {$p_zone_id}',\n        '{$p_metropolitan}', '{$p_ward_no}','{$p_address}', '{$p_house_no}', '{$p_phone}', ' {$temp_district_id}','{$temp_zone_id}', '{$temp_metropolitan}',' {$temp_ward_no}','{$temp_address}',\n        ' {$temp_house_no}',' {$temp_phone}', '{$nabalik_guardian_name}',' {$nabalik_relation}', '{$nabalik_identity_no}', '{$nabalik_district}', '{$nabalik_year}', '{$nabalik_address}','{$per_nagarikta}','{$per_identificationno}',\n        '{$per_district}', '{$per_year}', '{$bank_name}', '{$creditor_name}',' {$creditor_district}', '{$creditor_year}','{$creditor_address}')";
         $sqls[] = "insert into namsari_info\n        (vehicle_id,reason,date,comments, sakshi_name,sakshi_address,sakshi_identification,new_ownerid, old_ownerid,status)\n         values  ('{$vehicleid}','{$reason}','{$date}','{$remarks}','{$witness_name}','{$witness_address}','{$citizenship_no}',(select last_insert_id()),'" . $old_owner_id[0]['owner_id'] . "','initial')";
         //set db to remote
         DB::sql($sqls);
         $photo_name = DB::sql("select new_ownerid from namsari_info where vehicle_id='" . $vehicleid . "' order by new_ownerid desc");
         //update photo
         $onlineSql[] = "update owner_photo set picture='" . $photo_name[0]['new_ownerid'] . ".jpg' where vehicle_id='" . $vehicle . "'";
         //set db to old one
         F3::set('DB', new DB(F3::get("local_param.local_host"), F3::get("local_param.local_user"), F3::get("local_param.local_password")));
         DB::SQL($onlineSql);
         rename("photo/" . $vehicle . ".jpg", "photo/" . $photo_name[0]['new_ownerid'] . ".jpg");
         AdminLog::add($vehicleNo, "namsari", "approved");
         //success message
         F3::set('nav', 'navigation');
         F3::set('message', 'The data has been approved');
         F3::set('templateAdmin', 'approve');
         echo Template::serve("template/layout.html");
     } else {
         F3::set('message', 'The data doesnot exist');
         F3::set('nav', 'navigation');
         F3::set('templateAdmin', 'approve');
         echo Template::serve("template/layout.html");
     }
 }