Notes
Notes - notes.io |
{
$replay = array();
$row_result = array();
$this->db->query("SET ANSI_NULLS ON; SET ANSI_WARNINGS ON;");
if (!$this->Mdl_apikey->isOkKey($parin)) {
$replay['status'] = "PROJECTDENIED";
$replay['notif'] = "Illegal projects are not permitted.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
$user = $parin['user'];
$token = $parin['token'];
/* query cek akses user */
$sql_loginuse = $this->db->query("select a.nik,b.subjabatan_user,a.stts_picorder,a.closenon,a.closedir,menuorder1 = (select count(*) from andro_priority_picorder with (nolock) where nik=a.nik and menu_picorder='order1')
from andro_user a with (nolock)
left join andov_maf_user b with (nolock) on a.nik = b.nik
where a.nik='$user' and a.token='$token' and a.deletests='0'");
if ($sql_loginuse->num_rows() == 0) {
$replay['status'] = "USERDENIED";
$replay['notif'] = "Maaf, permintaan anda ditolak.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
$val_loginuse = $sql_loginuse->row(0);
$jabatan = $this->lib_fungsi->replaceSubJabatan($val_loginuse->subjabatan_user);
$dealerid = $parin['dealerid'];
if ($dealerid == "00097") {
$DealerName = "DIRECT";
} else {
$DealerName = $parin['DealerName'];
}
$sumber_order = $parin['sumber_order'];
$custtype = $parin['custtype'];
$CustName = $parin['CustName'];
$telp_nasabah = $parin['telp_nasabah'];
$Branchid = $parin['Branchid'];
$OtherBranch = $parin['OtherBranch'];
$categorygroup = $parin['categorygroup'];
$categoryid = $parin['categoryid'];
$purpose = $parin['purpose'];
$ProductCode = $parin['ProductCode'];
$merkid = $parin['merkid'];
$MerkName = $parin['MerkName'];
$modelid = $parin['modelid'];
$ModelName = $parin['ModelName'];
$Type = $parin['Type'];
$Tahun = $parin['Tahun'];
$saletype = $parin['saletype'];
$loantype = $parin['loantype'];
$OTR = $this->lib_fungsi->isEmpty($parin['OTR'], 0);
$DP = $this->lib_fungsi->isEmpty($parin['DP'], 0);
$minimaldppersen = $this->lib_fungsi->isEmpty($parin['minimaldppersen'], 0);
$minimaldpnominal = $this->lib_fungsi->isEmpty($parin['minimaldpnominal'], 0);
$PH = $this->lib_fungsi->isEmpty($parin['PH'], 0);
$tenor = $parin['tenor'];
$flatrate = $this->lib_fungsi->isEmpty($parin['flatrate'], 0);
$effectiverate = $this->lib_fungsi->isEmpty($parin['effectiverate'], 0);
$minimumflatrate = $this->lib_fungsi->isEmpty($parin['minimumflatrate'], 0);
$admfee = $this->lib_fungsi->isEmpty($parin['admfee'], 0);
$fiduciafee = $this->lib_fungsi->isEmpty($parin['fiduciafee'], 0);
$angsuran = $this->lib_fungsi->isEmpty($parin['angsuran'], 0);
$angsuranreal = $this->lib_fungsi->isEmpty($parin['angsuranreal'], 0);
$pencairan = $this->lib_fungsi->isEmpty($parin['pencairan'], 0);
$stsAss = $parin['stsAss'];
$cabangasuransi = $parin['cabangasuransi'];
$rateasuransi = $parin['rateasuransi'];
$premiasuransi = $this->lib_fungsi->isEmpty($parin['premiasuransi'], 0);
$npvflat = $this->lib_fungsi->isEmpty($parin['npvflat'], 0);
$npveffective = $this->lib_fungsi->isEmpty($parin['npveffective'], 0);
$npvnominal = $this->lib_fungsi->isEmpty($parin['npvnominal'], 0);
$kondisikendaraan = $parin['kondisikendaraan'];
$sts_ordereksternal = $parin['sts_ordereksternal'];
$sts_orderinternal = $parin['sts_orderinternal'];
$lokasi_app1 = $parin['lokasi_app1'];
$user_app1 = $user;
$CreateUserId = $user;
$codePrio = $this->lib_fungsi->isEmpty($parin['codePriority'], 0);
$cust_iden = $this->lib_fungsi->isEmpty($parin['cust_identitas'], "");
/* error_bantuan_user */
/** rencana tambahan
$exec_cek_bantuan_user = $this->db->query("select isnull(bantuan_user,0) bantuan_user,* from ITDept.dbo.book_showroom_member where dealerid = '10763' and deletests = 0");
$val_bantuan_user = $exec_cek_bantuan_user->row(0);
if($val_bantuan_user->bantuan_user == "1"){
$sumber_order = 1;
}
*/
/** notifikasi komite kredit bermasalah jika sumber order 1 tapi diinput dari menu non member AM */
$setclose = true;
if ($val_loginuse->stts_picorder == "0") {
$replay['status'] = "YOUAREOFF";
$replay['notif'] = "Maaf, Saat Ini Anda Dalam Posisi Order OFF.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
if ($sumber_order == '2') {
if ($val_loginuse->closenon == "0" && $val_loginuse->menuorder1 > 0) {
$setclose = false;
}
} else if ($sumber_order == '3') {
if ($val_loginuse->closedir == "0" && $val_loginuse->menuorder1 > 0) {
$setclose = false;
}
}
/**
* Proses insert order
*/
if ($setclose) {
$replay['status'] = "CLOSE";
$replay['notif'] = "Mohon Maaf, Saat Ini Menu Tidak Dapat Diakses.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
$sql_konversi_flat = $this->db->query("select top 1 effectiverate,flatrate from ITdept.dbo.maf_parameter_bunga where deletests='0' and tenor='" . $tenor . "' and flatrate >=" . $flatrate . " and loantype='" . $loantype . "' order by flatrate");
$val_konversi_flat = $sql_konversi_flat->row(0);
if ($val_konversi_flat->effectiverate != $effectiverate) {
$replay['status'] = "NODATA";
$replay['notif'] = "Maaf, mohon pastikan perhitungan skim kredit sudah berjalan.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
/** ************************************** ## versi testing ## *****************************************/
$sql_insnondir = $this->db->query("declare @tgl datetime,@today datetime
set @tgl = convert(varchar(26),getdate(),23)
set @today = getdate()
insert into ITDept.dbo.book_regAplikasi
(RegDate,OrderDate,dealerid,DealerName,sumber_order,custtype,CustName,telp_nasabah,Branchid,OtherBranch,categorygroup,categoryid,
purpose,ProductCode,merkid,MerkName,modelid,ModelName,Type,Tahun,saletype,loantype,OTR,DP,minimaldppersen,minimaldpnominal,PH,tenor,flatrate,
effectiverate,minimumflatrate,admfee,fiduciafee,angsuran,angsuranreal,pencairan,stsAss,cabangasuransi,rateasuransi,premiasuransi,npvflat,npveffective,
npvnominal,kondisikendaraan,sts_ordereksternal,sts_orderinternal,lokasi_app1,jam_app1,user_app1,CreateUserId,CreateDate,deletests)
values
(@tgl,@tgl,'$dealerid','$DealerName',$sumber_order,'$custtype','$CustName','$telp_nasabah','$Branchid','$OtherBranch','$categorygroup','$categoryid',
'$purpose','$ProductCode','$merkid','$MerkName','$modelid','$ModelName','$Type','$Tahun','$saletype','$loantype',$OTR,$DP,$minimaldppersen,$minimaldpnominal,$PH,$tenor,$flatrate,
$effectiverate,$minimumflatrate,$admfee,$fiduciafee,$angsuran,$angsuranreal,$pencairan,'$stsAss','$cabangasuransi','$rateasuransi',$premiasuransi,$npvflat,$npveffective,
$npvnominal,'$kondisikendaraan','$sts_ordereksternal','$sts_orderinternal','$lokasi_app1',@today,'$user_app1','$CreateUserId',@today,'0')");
if (!$sql_insnondir) {
$replay['status'] = "NODATA";
$replay['notif'] = "Order Non Member Gagal.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
if ($stsAss == "A") {
//$this->db->query("declare @RegId decimal
// set @RegId = (select top 1 RegId from ITDept.dbo.book_regAplikasi where CreateUserId = '$user' order by CreateDate desc)
// delete from ITDept.dbo.book_fntCarInsSchemeNew where regid = @RegId
// insert into ITDept.dbo.book_fntCarInsSchemeNew exec ITDept.dbo.book_sp_hitungasuransi_insert @RegId,$tenor,$OTR,'$rateasuransi'");
$this->db->query("declare @RegId decimal
set @RegId = (select top 1 RegId from ITDept.dbo.book_regAplikasi with (nolock) where CreateUserId = '$user' order by CreateDate desc)
EXEC ITDept.dbo.book_insert_sp_hitungasuransi_insert_xml @RegId,$tenor,$OTR,'$rateasuransi'");
}
/**Set Priority Order */
$this->db->query("DECLARE @Regid decimal
set @Regid = (select top 1 RegId from ITDept.dbo.book_regaplikasi with(nolock) where CreateUserId = '$user' order by CreateDate desc)
INSERT into ITDept.dbo.book_priority (regid,priority,lastupdate,lastuser) values (@Regid,'" . $codePrio . "',getdate(),'" . $user . "')");
$cekSegmentasi = $this->db->query("SELECT TOP 1 segmentid,no_identitas,financing_product from itdept.dbo.book_regAplikasi_segment where createuser = '$user' and isnull(deletests,0) = 0 ORDER BY createdate DESC");
if ($cekSegmentasi->num_rows() > 0) {
$val = $cekSegmentasi->row(0);
$tipePembiayaan = $val->financing_product;
$updateSegment = $this->db->query("DECLARE @regId int
set @regid = (select top 1 RegId from ITdept.dbo.book_regaplikasi with (nolock) where createuserId = '$user' order by CreateDate desc)
UPDATE itdept.dbo.book_regaplikasi_segment set regid = @regid, lastupdate = getDate(), lastuser = '$user' where createuser = '$user' and isnull(deletests,0) = 0 and (regid = 0 or regid = '')
UPDATE itdept.dbo.book_segment_value set regid = @regid, lastupdate = getDate(), lastuser = '$user' where createuser = '$user' and isnull(deletests,0) = 0 and (regid = 0 or regid = '')
");
if ($updateSegment && $tipePembiayaan == "4") {
$this->db->query("
DECLARE @regId int
set @regid = (select top 1 RegId from ITdept.dbo.book_regaplikasi with (nolock) where createuserId = '$user' order by CreateDate desc)
exec ITdept.dbo.book_getdatanasabah_topup '$cust_iden', 'I', @regid, '$user'");
}
}
/**
* Script Notifikasi
*/
/* pemberitahiuan ke user pic order 2 di branch tertentu ketika procced skim oleh AM (Order 1)(sumber_order 2,3) */
$title = "Order Masuk | " . $jabatan;
$message = substr($DealerName, 0, 20) . " | " . ucwords(strtolower($CustName));
$sql_orderto = $this->db->query("declare @menu_picorder varchar(10),@branchid varchar(4)
set @menu_picorder = 'order2'
set @branchid = '$Branchid'
select top 1 b.nik,b.username,b.token,b.sts_login,a.RegId,a.custname,a.dealername,a.branchid,a.gruporder_id from ITDept.dbo.book_regAplikasi a with (nolock)
left join androv_user_branch_picorder_access b with (nolock) on b.branchid=a.branchid
where b.menu_picorder = @menu_picorder
and a.branchid = @branchid
and b.priority = (select top 1 priority from androv_user_branch_picorder_access with (nolock)
where branchid = a.branchid and
menu_picorder = @menu_picorder and
stts_picorder = 1 group by priority order by priority)
order by CreateDate desc");
if ($sql_orderto->num_rows() > 0) {
foreach ($sql_orderto->result() as $val_orderto) {
$token = $val_orderto->token;
$bundle = array("keyRequestMenu" => "20", "RegId" => $val_orderto->RegId);
if (($token != "xxxxxxxxxx") && (!empty(trim($token))) && $val_orderto->sts_login == 1) {
$this->lib_notifikasi->push_notification("in", $token, $title, $message, "id.co.multindo.sismafmobile.in_Order2", $bundle);
// TODO insert history order -> DONE, BELUM TESTING
$sql = "INSERT INTO ITDept.dbo.book_history_date (date_key,doing_date,pic,location,note,maf_system,menu,deletests)
values (?,getDate(),?,?,?,?,?,0)";
$note = 'PROCEED ORDER 1';
$maf_system = 2;
$menu = 'ORDER 1';
$param = array($val_orderto->RegId, $user, $lokasi_app1, $note, $maf_system, $menu);
$this->db->query($sql, $param);
}
}
}
/**
* End Script Notifikasi
*/
$replay['status'] = "SUCCESS";
$replay['notif'] = "Order Non Member berhasil.";
$this->db->query("SET ANSI_NULLS OFF; SET ANSI_WARNINGS OFF;");
$replay['result'] = $row_result;
return $replay;
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
