public int[] OPPerDay(string date) { // OPDetails per day index - 1 = No of OP - 2 No of Paid OP OPDetailsPerDay[0] = OrderOfPayment.getNumberOfOP(); OPDetailsPerDay[1] = OrderOfPayment.getNumberOfPaidOP(); return(OPDetailsPerDay); }
private void frmOPDetails_Load(object sender, EventArgs e) { OrderOfPayment OP = new OrderOfPayment(); Dictionary<string,string> data = OP.getOPDataWOOR(OPNo); mtOPNo.Text = "" + OPNo; mtPayor.Text = data["Payor"]; mtTotal.Text = data["Amount"]; mtDateIssued.Text = data["DateIssued"]; mtPaid.Text = OP.getPaymentStatus(); mtOPType.Text = OP.getOPType(); this.ControlBox = true; string[][] particulars = OP.getOrderOfPaymentItem(OPNo); new clsDB().Con().listViewTransferData(particulars, listView1); }
public bool addOPItem(int orderOfPaymentNo, Dictionary <string, float> amountPerParticular, int OPType = 0, string NSTPType = null) { string query = ""; bool isValid = false; int accountCode = 0; for (int i = 0; i < amountPerParticular.Count; i++) { if (!string.IsNullOrEmpty(NSTPType)) { if (amountPerParticular.Keys.ToList()[i] == "CWTS/ROTC") { // Need to remove a existing key in the dictionary because it is not possible to update a key value float temp = amountPerParticular[amountPerParticular.Keys.ToList()[i]]; amountPerParticular.Remove("CWTS/ROTC"); amountPerParticular.Add(NSTPType, temp); accountCode = OrderOfPayment.assessmentID(NSTPType); } else { accountCode = OrderOfPayment.assessmentID(amountPerParticular.Keys.ToList()[i]); } } else { accountCode = OrderOfPayment.assessmentID(amountPerParticular.Keys.ToList()[i]); } query = "INSERT INTO tbl_PayOrder_Details (OPSeqNo, AcctCode, particular, amount, OPType) VALUES (" + orderOfPaymentNo + "," + accountCode + ", '" + amountPerParticular.Keys.ToList()[i] + "'," + amountPerParticular[amountPerParticular.Keys.ToList()[i]] + "," + OPType + ")"; isValid = new clsDB().Con().ExecuteSql(query); } return(isValid); }
// ***************** DAILY REPORT LAYOUT 1 PRINTING ******************* void ePrint_dailyReportLayoutOne(object sender, PrintPageEventArgs e) { // ------- VARIABLES ------- string queryMain = "SELECT OP.SeqNo,OP.SemNo,OfRec.Date_Paid, OfRec.ORNumber,OP.Payor,OfRec.Amount as ORAmount,OP.DateIssued,OP.OPNo,OP.Amount as OPAmount,OP.Purpose as Purpose,ISNULL(OfRec.PaymentType,0) as PaymentType FROM Collections as OfRec JOIN tbl_PayOrder as OP ON OP.OPNo = OfRec.OPNumber JOIN Collection_Details as CD ON CD.ORNumber = OfRec.ORNumber WHERE Date_Paid = '" + date + "' AND OPType = " + OPType + " " + pageIdentifier + " ORDER BY OfRec.ORNumber ASC"; string queryTemp = queryMain; int xInc = 0, lineCounter = 0, recordCount = new clsDB().Con().countRecord(queryMain); OPTotal = 0; ORTotal = 0; clsCollection col = new clsCollection(); Graphics graphic = e.Graphics; Font font = new Font("Arial", 10); PageNo++; // *** PRINT HEADER *** headerPrintLayout1(graphic, e); // check if For Summary // SUMMARY if (forSummary) { Dictionary <string, float> dataSummary = col.summaryOfCollection(OPType, date); // SPACING string[] space = { "", "", "", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, space); xInc += 21; // For Summary Heading string[] summaryOne = { "Summary : ", "", "", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, summaryOne); xInc += 21; // Main Operation for (int i = 0; i < dataSummary.Count; i++) { string[] summaryTwo = { "", "", dataSummary.Keys.ToList()[i], Convert.ToString(dataSummary[dataSummary.Keys.ToList()[i]]), "", "", "", "", "" }; summaryTotal += dataSummary[dataSummary.Keys.ToList()[i]]; rowPrinting(graphic, e, xInc, summaryTwo); xInc += 21; } // For Summary Total string[] summaryTotalHeader = { "", "", "Total : ", summaryTotal.ToString(), "", "", "", "", "" }; rowPrinting(graphic, e, xInc, summaryTotalHeader); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = false; forSummary = false; return; } // ******* MAIN PROCESS ******* for (int j = 0; j < recordCount; j++) { Dictionary <string, string> reportData = new Dictionary <string, string>(); new clsDB().Con().SelectDataDictionary(queryTemp, reportData); // get Final Particular if (reportData.Count() > 0) { OrderOfPayment OP = new OrderOfPayment(); // Check if Order Of Payment is Cancelled if (int.Parse(reportData["PaymentType"]) == 9) { string[] data = { reportData["ORNumber"], "Code", "Cancelled", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, data); xInc += 21; } else { string particulars = OP.modConcatOrderOfPaymentItem(col.getCollectionItem(int.Parse(reportData["ORNumber"])), reportData["Purpose"]); // get Semester particulars += "-" + Semester.getCurrentSemesterString().Replace("Semester", "Sem").Replace("20", ""); string[] dataA = { reportData["ORNumber"], "Code", reportData["Payor"], particulars, reportData["ORAmount"], reportData["DateIssued"], reportData["OPNo"], reportData["OPAmount"], "" }; // Compute Total OPTotal += float.Parse(reportData["OPAmount"]); ORTotal += float.Parse(reportData["ORAmount"]); rowPrinting(graphic, e, xInc, dataA); xInc += 21; } // quick fix queryTemp = "SELECT TOP 1 OP.SeqNo,OP.SemNo,OfRec.Date_Paid, OfRec.ORNumber,OP.Payor,OfRec.Amount as ORAmount,OP.DateIssued,OP.OPNo,OP.Amount as OPAmount,OP.Purpose as Purpose,ISNULL(OfRec.PaymentType,0) as PaymentType FROM Collections as OfRec JOIN tbl_PayOrder as OP ON OP.OPNo = OfRec.OPNumber JOIN Collection_Details as CD ON CD.ORNumber = OfRec.ORNumber WHERE Date_Paid = '" + date + "' AND OPType = " + OPType + " AND OPNo >" + reportData["OPNo"]; lineCounter++; } if (lineCounter > 19) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; if (recordCount > 20) { hasMorePages = true; pageIdentifier = " AND OPNo >" + reportData["OPNo"]; string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; rowPrinting(graphic, e, xInc, dataTotal); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = true; return; } } } /************ FINAL PRINTING ***************/ if (hasMorePages) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; /*string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; * rowPrinting(graphic, e, xInc, dataTotal); * * string[] dataGrandTotal = { "", "", "", "Grand Total", Convert.ToString(ORGrandTotal), "", "", Convert.ToString(OPGrandTotal), "" }; * rowPrinting(graphic, e, xInc + 21, dataGrandTotal); */ // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = false; hasMorePages = false; } if (hasMorePages == false) { if (OPGrandTotal == 0 && ORGrandTotal == 0) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; } string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; rowPrinting(graphic, e, xInc, dataTotal); string[] dataGrandTotal = { "", "", "", "Grand Total", Convert.ToString(ORGrandTotal), "", "", Convert.ToString(OPGrandTotal), "" }; rowPrinting(graphic, e, xInc + 21, dataGrandTotal); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); forSummary = true; e.HasMorePages = true; } }
private void lvManageRecord_SelectedIndexChanged(object sender, EventArgs e) { if (lvManageRecord.SelectedItems.Count > 0) { lbPaid.Visible = false; btnPay.Enabled = true; lbPaid.Text = "PAID( OR # "; orderOfPaymentID = int.Parse(lvManageRecord.SelectedItems[0].SubItems[0].Text); string query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + orderOfPaymentID +"'"; new clsDB().Con().FillLvw(listView1, query); Dictionary<string, string> data = new Dictionary<string, string>(); new clsDB().Con().SelectDataDictionary("SELECT DISTINCT OP.SemNO , OP.Payor as Payor,OP.DateIssued FROM tbl_PayOrder as OP LEFT JOIN Student_Account as SA ON OP.StudID = SA.StudID LEFT JOIN Student as S ON S.StudID = OP.StudID WHERE OP.OPNo = " + orderOfPaymentID, data); //new clsDB().Con().SelectDataDictionary("SELECT * FROM Student_Account as SA JOIN student as S on SA.StudID = S.StudID JOIN tbl_PayOrder as OP ON SA.StudID = OP.StudID WHERE OP.OPNo = "+ orderOfPaymentID , data); lbFName.Text = data["Payor"] ; DateTime dt = DateTime.Parse(data["DateIssued"]); lbDate.Text = dt.ToShortDateString(); OrderOfPayment OP = new OrderOfPayment(); if (OP.hasORNumber(orderOfPaymentID)) { btnPay.Enabled = false; lbPaid.Visible = true; lbPaid.Text += OP.ORNumber.ToString() +")"; } // Compute Total float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; lbTotal.Text = "Total = " + Convert.ToString(temp); lbTuition.Text = "Tuition = " + Convert.ToString(total[0]); lbMsc.Text = "Msc = " + Convert.ToString(total[1]); listView1.Visible = true; } }
public frmPaymentDataEntry() { InitializeComponent(); tbORNo.Text = OrderOfPayment.getLastORNo(); OP = new OrderOfPayment(); }
private void btnSave_Click(object sender, EventArgs e) { if (lvDataEntryOP.Items.Count > 0) { float total = float.Parse(lbTotal.Text); if (total > 0 && (!string.IsNullOrEmpty(tbFirstname.Text) && !string.IsNullOrEmpty(tbLastname.Text))) { OrderOfPayment OP = null; StudentAccount SAccount = new StudentAccount(); Dictionary<string, float> amountPerParticular = SAccount.getAmountPerParticular(lvDataEntryOP,2); string payor = tbFirstname.Text.Replace("'","''") + " " + tbMiddlename.Text + " " + tbLastname.Text; int orderOfPaymentType = 0 ; try { orderOfPaymentType = int.Parse((mrbUndergrad.Checked) ? mrbUndergrad.Tag.ToString() : (mrbMasteral.Checked) ? mrbMasteral.Tag.ToString() : (mrbFiduciary.Checked) ? mrbFiduciary.Tag.ToString() : (mrbBtr.Checked) ? mrbBtr.Tag.ToString() : (mrbIGD.Checked) ? mrbIGD.Tag.ToString() : "0" ); paymentType = (mtrbCash.Checked) ? mtrbCash.Tag.ToString() : (mtrbCheck.Checked) ? mtrbCheck.Tag.ToString() : "0"; } catch (Exception ex) { MessageBox.Show(ex.Message); } // check payment type // check if has student ID int studentID = 0; if(lbStudID.Text != "[ Student ID ]") studentID = int.Parse(lbStudID.Text); string purpose = "Other Fees"; // Purpose if (isTuitionFee) { purpose = "Tuition Fee/Misc"; } // has check details if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text),int.Parse(paymentType)); } else if (mtrbCash.Checked) OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, null, null, null, 0, int.Parse(paymentType)); else MessageBox.Show("There are some fields missing!"); // final validation if (OP != null) { if (OP.createOP()) { OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, orderOfPaymentType); MessageBox.Show("Successful! \n \t Please Proceed to Payment"); Dictionary<string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text)); ePrinting print = new ePrinting(OPData); print.ePrint("OP"); this.Dispose(); frmOrPayDataEntry temp = new frmOrPayDataEntry(); temp.ShowDialog(); } } } else { MessageBox.Show("Invalid Input / Missing Field"); } } else { MessageBox.Show("Please add an item"); } }
// ***************** DAILY REPORT LAYOUT 1 PRINTING ******************* void ePrint_dailyReportLayoutOne(object sender, PrintPageEventArgs e) { // ------- VARIABLES ------- string queryMain = "SELECT OP.SeqNo,OP.SemNo,OfRec.Date_Paid, OfRec.ORNumber,OP.Payor,OfRec.Amount as ORAmount,OP.DateIssued,OP.OPNo,OP.Amount as OPAmount,OP.Purpose as Purpose,ISNULL(OfRec.PaymentType,0) as PaymentType FROM Collections as OfRec JOIN tbl_PayOrder as OP ON OP.OPNo = OfRec.OPNumber JOIN Collection_Details as CD ON CD.ORNumber = OfRec.ORNumber WHERE Date_Paid = '" + date + "' AND OPType = " + OPType + " " + pageIdentifier + " ORDER BY OfRec.ORNumber ASC"; string queryTemp = queryMain; int xInc = 0, lineCounter = 0, recordCount = new clsDB().Con().countRecord(queryMain); OPTotal = 0; ORTotal = 0; clsCollection col = new clsCollection(); Graphics graphic = e.Graphics; Font font = new Font("Arial", 10); PageNo++; // *** PRINT HEADER *** headerPrintLayout1(graphic, e); // check if For Summary // SUMMARY if (forSummary) { Dictionary<string, float> dataSummary = col.summaryOfCollection(OPType, date); // SPACING string[] space = { "", "", "", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, space); xInc += 21; // For Summary Heading string[] summaryOne = { "Summary : ", "", "", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, summaryOne); xInc += 21; // Main Operation for (int i = 0; i < dataSummary.Count; i++) { string[] summaryTwo = { "", "", dataSummary.Keys.ToList()[i], Convert.ToString(dataSummary[dataSummary.Keys.ToList()[i]]), "", "", "", "", ""}; summaryTotal += dataSummary[dataSummary.Keys.ToList()[i]]; rowPrinting(graphic, e, xInc, summaryTwo); xInc += 21; } // For Summary Total string[] summaryTotalHeader = { "", "", "Total : ", summaryTotal.ToString(), "", "", "", "", "" }; rowPrinting(graphic, e, xInc, summaryTotalHeader); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = false; forSummary = false; return; } // ******* MAIN PROCESS ******* for (int j = 0; j < recordCount; j++ ) { Dictionary<string, string> reportData = new Dictionary<string, string>(); new clsDB().Con().SelectDataDictionary(queryTemp, reportData); // get Final Particular if (reportData.Count() > 0) { OrderOfPayment OP = new OrderOfPayment(); // Check if Order Of Payment is Cancelled if (int.Parse(reportData["PaymentType"]) == 9) { string[] data = { reportData["ORNumber"], "Code", "Cancelled", "", "", "", "", "", "" }; rowPrinting(graphic, e, xInc, data); xInc += 21; } else { string particulars = OP.modConcatOrderOfPaymentItem(col.getCollectionItem(int.Parse(reportData["ORNumber"])), reportData["Purpose"]); // get Semester particulars += "-" + Semester.getCurrentSemesterString().Replace("Semester", "Sem").Replace("20", ""); string[] dataA = { reportData["ORNumber"], "Code", reportData["Payor"], particulars, reportData["ORAmount"], reportData["DateIssued"], reportData["OPNo"], reportData["OPAmount"], "" }; // Compute Total OPTotal += float.Parse(reportData["OPAmount"]); ORTotal += float.Parse(reportData["ORAmount"]); rowPrinting(graphic, e, xInc, dataA); xInc += 21; } // quick fix queryTemp = "SELECT TOP 1 OP.SeqNo,OP.SemNo,OfRec.Date_Paid, OfRec.ORNumber,OP.Payor,OfRec.Amount as ORAmount,OP.DateIssued,OP.OPNo,OP.Amount as OPAmount,OP.Purpose as Purpose,ISNULL(OfRec.PaymentType,0) as PaymentType FROM Collections as OfRec JOIN tbl_PayOrder as OP ON OP.OPNo = OfRec.OPNumber JOIN Collection_Details as CD ON CD.ORNumber = OfRec.ORNumber WHERE Date_Paid = '" + date + "' AND OPType = " + OPType + " AND OPNo >" + reportData["OPNo"]; lineCounter++; } if (lineCounter > 19) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; if (recordCount > 20) { hasMorePages = true; pageIdentifier = " AND OPNo >" + reportData["OPNo"]; string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; rowPrinting(graphic, e, xInc, dataTotal); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = true; return; } } } /************ FINAL PRINTING ***************/ if (hasMorePages) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; /*string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; rowPrinting(graphic, e, xInc, dataTotal); string[] dataGrandTotal = { "", "", "", "Grand Total", Convert.ToString(ORGrandTotal), "", "", Convert.ToString(OPGrandTotal), "" }; rowPrinting(graphic, e, xInc + 21, dataGrandTotal); */ // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); e.HasMorePages = false; hasMorePages = false; } if(hasMorePages == false) { if (OPGrandTotal == 0 && ORGrandTotal == 0) { OPGrandTotal += OPTotal; ORGrandTotal += ORTotal; } string[] dataTotal = { "", "", "", "Sub-Total", Convert.ToString(ORTotal), "", "", Convert.ToString(OPTotal), "" }; rowPrinting(graphic, e, xInc, dataTotal); string[] dataGrandTotal = { "", "", "", "Grand Total", Convert.ToString(ORGrandTotal), "", "", Convert.ToString(OPGrandTotal), "" }; rowPrinting(graphic, e, xInc + 21, dataGrandTotal); // *** PRINT FOOTER *** footerPrintLayout1(graphic, e); forSummary = true; e.HasMorePages = true; } }
private void btnSave_Click(object sender, EventArgs e) { // instantiate student object try { if ( !Helper.strIsEmpty(tAmount.Text, true)) { Student st = new Student(listView1.Items[0].SubItems[1].Text); string course = st.course(); // temporary conditioning to check if a student is masteral or undergrad int OPType = (course.StartsWith("B")) ? 2 : 3; Dictionary<string,float> amountPerParticular = SAccount.getAmountPerParticular(listView1,3,"tuition/msc"); if (amountPerParticular["Tuition Fee"] > 0 && amountPerParticular["Tuition Fee"] > float.Parse(tAmount.Text)) { amountPerParticular["Tuition Fee"] = float.Parse(tAmount.Text) - float.Parse(lbMscFee.Text); } // validation bool isValid = false; string paymentType = (isFullPayment) ? "full" : "partial"; bool isCheck = false; if (mtrbCheck.Checked) isCheck = true; else if (mtrbCash.Checked) isCheck = false; // check if NSTP is selected string NSTP = (mtrbCWTS.Checked) ? mtrbCWTS.Text : (mtrbROTC.Checked) ? mtrbROTC.Text : null; if (string.IsNullOrEmpty(NSTP) && hasNSTP) { isValid = false; MessageBox.Show("Please select NSTP Type"); return; } isValid = StudentAccount.validateAmout(paymentType, float.Parse(lbTotal.Text), float.Parse(tAmount.Text), float.Parse(lbTuitionFee.Text), float.Parse(lbMscFee.Text), isCheck); if (isValid ) { // ---------------- FINAL PROCEDURE ------------------- if (isValid) { OrderOfPayment OP = null; if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] +' '+ studentData[4] +' '+studentData[2], int.Parse(studentData[0]), "", mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text)); } else if (mtrbCash.Checked) OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] + ' ' + studentData[4] + ' ' + studentData[2], int.Parse(studentData[0])); else MessageBox.Show("There are some fields missing!"); // validated if (OP != null) { if (OP.createOP()) { OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, OPType, NSTP); MessageBox.Show("Successful! \n \t Please Proceed to Payment"); Dictionary<string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text)); ePrinting print = new ePrinting(OPData); print.ePrint("OP"); Close(); } } } } } else { MessageBox.Show("Please select "); } } catch(Exception ex) { MessageBox.Show("There are some fields missing", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }