public frmLogin(frmHome.MsgHandler s) { clsCollection col = new clsCollection(); col.summaryOfCollection(3); InitializeComponent(); Selected = s; }
private void mtbSearch_Click(object sender, EventArgs e) { // check if OPNo is valid int OPNo = 0; try { OPNo = int.Parse(tOPNo.Text); } catch (Exception ex) { MessageBox.Show("Invalid OP Number"); return; } float temp = 0; string query = "SELECT * FROM tbl_PayOrder WHERE OPNo = " + OPNo; if (new clsDB().Con().countRecord(query) > 0) { // Compute Total query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + OPNo + "'"; new clsDB().Con().FillLvw(listView1, query); float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; frmPaymentDataEntry f = new frmPaymentDataEntry(this.lastORNumber); f.total = temp; f.orderOfPaymentNo = OPNo; f.listLength = listView1.Items.Count; f.ShowDialog(); this.lastORNumber = f.lastORNumber; parent.lbTotalCollection.Text = "" + Cashier.classes.clsCollection.getDailyAccumulatedAmount(DateTime.Now.ToShortDateString()); string date = DateTime.Now.ToShortDateString(); Cashier.classes.clsCollection c = new Cashier.classes.clsCollection(); Dictionary <string, float> summary = c.summaryOfCollection(2, date); for (int i = 0; i < summary.Count; i++) { ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = summary.Keys.ToList()[i]; ListViewItem.ListViewSubItem item = new ListViewItem.ListViewSubItem(); item.Text = Convert.ToString(summary[summary.Keys.ToList()[i]]); lvi.SubItems.Add(item); parent.lvSummaryOfCollection.Items.Add(lvi); } } else { MessageBox.Show("Invalid Order of Payment Number", "Input Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
// ***************** 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; } }
// ***************** 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; } }