} //End public void executeReport_TUNGGAKAN() //METHOD-CALC private Reportin_tunggakanVM calcTUNGGAKAN (Reportin_tunggakanVM poTUNGGAKAN, StudentdetailVM poSTUDENT, ClassleveldetailVM poCLASSLEVEL, TrintypedetailVM poTRINTYPES) { Boolean isCheck = true; Reportin_tunggakanVM vReturn = new Reportin_tunggakanVM(); vReturn = poTUNGGAKAN; Installment_indetailVM oINST = this.INSTALLMENTS_TUNGGAKAN. Where(fld => fld.INST_TYPEID == poTRINTYPES.ID && fld.STUDENT_ID == poSTUDENT.ID).SingleOrDefault(); //SPP if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SPP) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_SPP(poTUNGGAKAN, poCLASSLEVEL, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SPP) //EKSKUL if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_EKSKUL) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_EKSKUL(poTUNGGAKAN, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_EKSKUL) //SCLUB if ((poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SCLUB) && (isCheck)) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_SCLUB(poTUNGGAKAN, oINST); } //End if (poTRINTYPES.ID == valFLAG.FLAG_TRINTYPE_SCLUB) //OTHER if (isCheck) { isCheck = false; //Map Tunggakan vReturn = mapMONTHLY_OTHER(poTUNGGAKAN, oINST); } //End if (isCheck) return(vReturn); } //End private Reportin_tunggakanVM calcTUNGGAKAN(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES)
} //End public void prepareReport_TUNGGAKAN() public void executeReport_TUNGGAKAN() { //PREPARE REPORT this.prepareReport_TUNGGAKAN(); //INIT CLASSLEVEL FOR CALCULATION DATA ClassleveldetailVM itemCLASSLEVEL = null; //START LOOP REPORTS Boolean isNEW = true; foreach (var itemSTUDENT in this.STUDENTS) { if (itemSTUDENT.ID == 1696) { isNEW = true; } //RESET FOR STUDENT LOOP isNEW = true; //INIT itemTUNGGAKAN Reportin_tunggakanVM itemTUNGGAKAN = null; //GET CLASSLEVEL BY STUDENT (TODO: REFACTOR BY MODIFY DBVIEW itemCLASSLEVEL = CLASSLEVELS.Where(fld => fld.ID == itemSTUDENT.CLASSLEVEL_ID).SingleOrDefault(); foreach (var itemTRINTYPE in this.TRINTYPES) { if (isNEW) { isNEW = false; itemTUNGGAKAN = new Reportin_tunggakanVM(); itemTUNGGAKAN = initMAP(itemSTUDENT); } //End if (isNEW) itemTUNGGAKAN = this.calcTUNGGAKAN(itemTUNGGAKAN, itemSTUDENT, itemCLASSLEVEL, itemTRINTYPE); } //End foreach (var item2 in this.TRINTYPES) itemTUNGGAKAN = this.sumTUNGGAKAN(itemTUNGGAKAN); if (itemTUNGGAKAN.TRN_AMOUNT > 0) { TUNGGAKAN.Add(itemTUNGGAKAN); } } //End foreach (var item in this.STUDENTS) } //End public void executeReport_TUNGGAKAN()
} //End public void Create public void Update(ClassleveldetailVM poViewModel) { try { using (var db = new DBMAINContext()) { Classlevel oModel = db.Classlevels.AsNoTracking().SingleOrDefault(fld => fld.ID == poViewModel.ID); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.UPDATE); //Set DTA_STS oModel.DTA_STS = valFLAG.FLAG_DTA_STS_UPDATE; //Process CRUD db.Entry(oModel).State = EntityState.Modified; db.SaveChanges(); this.ID = oModel.ID; } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Update" + e.Message; } //End catch } //End public void Update
public ClasslevelCRUD() { } //End public ClasslevelCRUD() public void Create(ClassleveldetailVM poViewModel) { try { using (var db = new DBMAINContext()) { Classlevel oModel = new Classlevel(); //Map Form Data oModel.InjectFrom(poViewModel); //Set Field Header oModel.setFIELD_HEADER(hlpFlags_CRUDOption.CREATE); //Set DTA_STS oModel.DTA_STS = valFLAG.FLAG_DTA_STS_CREATE; //Process CRUD db.Classlevels.Add(oModel); db.SaveChanges(); this.ID = oModel.ID; } //End using } //End try catch (Exception e) { isERR = true; this.ERRMSG = "CRUD - Create: " + e.Message; } //End catch } //End public void Create
} //End public void setMONTHS_TUNGGAKAN() private Reportin_tunggakanVM mapMONTHLY_SPP_BACKUP(Reportin_tunggakanVM poTUNGGAKAN, ClassleveldetailVM poCLASSLEVEL, Installment_indetailVM poINST) { Reportin_tunggakanVM vReturn = new Reportin_tunggakanVM(); vReturn = poTUNGGAKAN; //Init Calc Variable decimal?nTRN_QTY = 12; decimal?nTRN_PRICE = poCLASSLEVEL.CLASSLEVEL_SPP; decimal?nTRN_AMOUNT = 0; Byte? nCURRENT_MONTH = this.SYSINFO.SYSMONTH_SEQNO; if (poINST != null) { //QTY if (poINST.INST_QTY != null) { decimal?nMONTH_TUNGGAKAN = (decimal?)(nCURRENT_MONTH - 1) - poINST.INST_QTY; if (nMONTH_TUNGGAKAN > 0) { nTRN_QTY = nMONTH_TUNGGAKAN; } } //End if (oINST.INST_QTY != null) //PRICE if (poINST.INST_PRICEBASE != null) { nTRN_PRICE = poINST.INST_PRICEBASE; } } //End if (oINST != null) //CALC QTY X PRICE nTRN_AMOUNT = nTRN_QTY * nTRN_PRICE; vReturn.TRN_AMOUNT_SPP = nTRN_AMOUNT; return(vReturn); } //End private Reportin_tunggakanVM mapMONTHLY_SPP(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES, Installment_indetailVM poINST)
} //End private decimal? mapMONTHLY_CALC(Installment_indetailVM poINST, decimal? pnTRN_QTY, decimal? pnTRN_PRICE) private Reportin_tunggakanVM mapMONTHLY_SPP(Reportin_tunggakanVM poTUNGGAKAN, ClassleveldetailVM poCLASSLEVEL, Installment_indetailVM poINST) { Reportin_tunggakanVM vReturn = new Reportin_tunggakanVM(); vReturn = poTUNGGAKAN; //Init Calc Variable decimal?nTRN_QTY = 12; decimal?nTRN_PRICE = poCLASSLEVEL.CLASSLEVEL_SPP; decimal?nTRN_AMOUNT = mapMONTHLY_CALC(poINST, nTRN_QTY, nTRN_PRICE); vReturn.TRN_AMOUNT_SPP = nTRN_AMOUNT; return(vReturn); } //End private Reportin_tunggakanVM mapMONTHLY_SPP(StudentdetailVM poSTUDENT, TrintypedetailVM poTRINTYPES, Installment_indetailVM poINST)
} //End public ClassleveldetailVM getData(int? id = null) public void getData(int?idClasslevel, int?idTrntype, int?IS_PINDAHAN) { ClassleveldetailVM oData = getData(idClasslevel); Boolean isSiswaPindah = false; if (IS_PINDAHAN == 1) { isSiswaPindah = true; } //SPP if (idTrntype == 1) { if (!isSiswaPindah) { //BASE this.TRND_PRICEBASE = oData.CLASSLEVEL_SPP; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_SPP; //DENDA (%) this.TRND_PRICEBASE_DENDA = oData.CLASSLEVEL_SPPDENDA; this.TRND_QTYBASE_DENDA = 1; this.TRND_AMOUNTBASE_DENDA = (oData.CLASSLEVEL_SPPDENDA / 100) * oData.CLASSLEVEL_SPP; } else { //BASE this.TRND_PRICEBASE = oData.CLASSLEVEL_SPPPINDAH; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_SPPPINDAH; //DENDA (%) this.TRND_PRICEBASE_DENDA = oData.CLASSLEVEL_SPPPINDAHDENDA; this.TRND_QTYBASE_DENDA = 1; this.TRND_AMOUNTBASE_DENDA = (oData.CLASSLEVEL_SPPPINDAHDENDA / 100) * oData.CLASSLEVEL_SPPPINDAH; } } //End if (idTrntype == 1) //SPP-Denda if (idTrntype == 2) { if (!isSiswaPindah) { //BASE this.TRND_PRICEBASE = oData.CLASSLEVEL_SPPDENDA; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = (oData.CLASSLEVEL_SPPDENDA / 100) * oData.CLASSLEVEL_SPP; //DENDA (%) this.TRND_PRICEBASE_DENDA = this.TRND_PRICEBASE; this.TRND_QTYBASE_DENDA = 1; this.TRND_AMOUNTBASE_DENDA = this.TRND_AMOUNTBASE; } else { //BASE this.TRND_PRICEBASE = (oData.CLASSLEVEL_SPPPINDAHDENDA / 100) * oData.CLASSLEVEL_SPPPINDAH; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = (oData.CLASSLEVEL_SPPPINDAHDENDA / 100) * oData.CLASSLEVEL_SPPPINDAH; //DENDA (%) this.TRND_PRICEBASE_DENDA = this.TRND_PRICEBASE; this.TRND_QTYBASE_DENDA = 1; this.TRND_AMOUNTBASE_DENDA = this.TRND_AMOUNTBASE; } } //End if (idTrntype == 2) //Mid Ganjil if (idTrntype == 3) { this.TRND_PRICEBASE = oData.CLASSLEVEL_MIDSEMESTER; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_MIDSEMESTER; } //End if (idTrntype == 3) //Mid Genap if (idTrntype == 4) { this.TRND_PRICEBASE = oData.CLASSLEVEL_MIDSEMESTER2; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_MIDSEMESTER2; } //End if (idTrntype == 4) //Semester Ganjil if (idTrntype == 5) { this.TRND_PRICEBASE = oData.CLASSLEVEL_SEMESTER; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_SEMESTER; } //End if (idTrntype == 5) //Semester genap if (idTrntype == 6) { this.TRND_PRICEBASE = oData.CLASSLEVEL_SEMESTER2; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_SEMESTER2; } //End if (idTrntype == 6) //Daftar Ulang if (idTrntype == 7) { this.TRND_PRICEBASE = oData.CLASSLEVEL_DFTULANG; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_DFTULANG; } //End if (idTrntype == 7) //Uang Akhir Tahun if (idTrntype == 8) { this.TRND_PRICEBASE = oData.CLASSLEVEL_AKHIRTAHUN; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_AKHIRTAHUN; } //End if (idTrntype == 8) //Ekstrakulikuler if (idTrntype == 9) { this.TRND_PRICEBASE = oData.CLASSLEVEL_EKSKUL; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_EKSKUL; } //End if (idTrntype == 9) //Studi Klub if (idTrntype == 10) { this.TRND_PRICEBASE = oData.CLASSLEVEL_STUDI; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_STUDI; } //End if (idTrntype == 10) //Prakerin if (idTrntype == 11) { this.TRND_PRICEBASE = oData.CLASSLEVEL_PRAKERIN; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_PRAKERIN; } //End if (idTrntype == 11) //Formulir if (idTrntype == 12) { this.TRND_PRICEBASE = oData.CLASSLEVEL_FORMULIR; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_FORMULIR; } //End if (idTrntype == 12) //Uang Pangkal if (idTrntype == 13) { this.TRND_PRICEBASE = oData.CLASSLEVEL_PANGKAL; this.TRND_QTYBASE = 1; this.TRND_AMOUNTBASE = oData.CLASSLEVEL_PANGKAL; } //End if (idTrntype == 13) } //End public ClassleveldetailVM getData(int? id = null)