コード例 #1
0
        public frmLogin(frmHome.MsgHandler s)
        {
            clsCollection col = new clsCollection();

            col.summaryOfCollection(3);

            InitializeComponent();
            Selected = s;
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        // ***************** 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;
            }
        }
コード例 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool hasPayment = false;
            if (float.Parse(tbAmount.Text) < float.Parse(lblAmountToPay.Text))
            {
                MessageBox.Show(" Invalid Amount");
            }
            else
            {

                string query = "SELECT SA.SeqNo, SA.StudID, SA.SemNo, SA.Particular, SA.Amount, ISNULL(SA.Payment,0), ISNULL(SA.Balance,0),OP.Amount FROM Student_Account as SA JOIN tbl_PayOrder as OP ON SA.StudID = OP.StudID WHERE OP.OPNo = ";
                int recordCount = new clsDB().Con().countRecord(query + orderOfPaymentNo);
                string[][] data = new string[recordCount][];

                // if it is for Student Account
                if (recordCount > 0)
                {
                    new clsDB().Con().SelectData(query + orderOfPaymentNo, data);

                    StudentAccount sa = new StudentAccount();
                    Dictionary<string, string> studentAccountData = sa.getData(data);

                    int tuitionSeqNo = int.Parse(studentAccountData["tuitionSeqNo"]);
                    float mFee = float.Parse(studentAccountData["mFee"]);
                    int StudID = int.Parse(studentAccountData["StudID"]);
                    int semNo = int.Parse(studentAccountData["SemNo"]);

                    if (StudentAccount.updatePayment(sa.seqNo, tuitionSeqNo, float.Parse(tbAmount.Text), StudID, mFee, semNo))
                    {
                        hasPayment = true;
                    }
                    else
                    {
                        MessageBox.Show("There was an error!");
                    }

                }
                // if for Misc Fees and other payments
                else
                {
                    hasPayment = true;
                }

            }

            // Final Procedure
            if (hasPayment)
            {
                string checkAmount = null, checkDate = null, checkNo = null, bankName = null, PaymentType = null ;

                OPData.TryGetValue("CheckAmount", out checkAmount);
                OPData.TryGetValue("CheckNo", out checkNo);
                OPData.TryGetValue("CheckDate", out checkDate);
                OPData.TryGetValue("BankName", out bankName);
                 OPData.TryGetValue("PaymentType", out PaymentType);

                clsCollection col = new clsCollection(orderOfPaymentNo, int.Parse(OrderOfPayment.getLastORNo()), dtORDate.Value.ToShortDateString(), float.Parse(tbAmount.Text), OPData["Payor"].Replace("'","''"), checkNo,bankName, checkDate, float.Parse(checkAmount), int.Parse(PaymentType));

                if (OP.updateOP(int.Parse(tbORNo.Text), orderOfPaymentNo))
                    if (col.create())
                    {
                        OP.paidOP(orderOfPaymentNo);
                        col.addCollectionItem();

                        string[][] particularsAmount = OP.getOrderOfPaymentItem(orderOfPaymentNo);

                        OPData["collectionDate"] = dtORDate.Value.ToShortDateString();
                        int currOrNumber = int.Parse(OrderOfPayment.getLastORNo()) - 1;
                        OPData["ORNumber"] = ""+currOrNumber;

                        ePrinting print = new ePrinting(OPData, particularsAmount);

                        // temporary fix for OTHER Payment
                        if (OPData["Purpose"] == "Other Fees")
                            print.isOtherPayment = true;

                        print.ePrint("OR");

                        Close();
                    }
            }
        }
コード例 #5
0
        // ***************** 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;
            }
        }