コード例 #1
0
        public bool createOP()
        {
            if (orderOfPaymentNo > 0)
            {
                string finalStudID = (StudID == 0) ? "null" : Convert.ToString(StudID);
                query = "INSERT INTO tbl_PayOrder (Amount, SemNo,AmtInWords, StudID, OPNo, DateIssued,Purpose,Payor,Remarks,BankName, CheckNo, CheckDate, CheckAmount, PaymentType) VALUES( " + amountNumeric + "," + Semester.getCurrentSemester() + ", '" + amountWords + "'," + finalStudID + "," + orderOfPaymentNo + ",'" + orderOfPaymentDate + "' " + ",'" + purpose + "', '" + payorName + "','" + remarks + "','" + bankName + "','" + checkNo + "','" + checkDate + "'," + checkAmount + "," + paymentType + ") ";
                if (!new clsDB().Con().ExecuteSql(query))
                {
                    MessageBox.Show("There is an error");
                    return(false);
                }
            }
            else
            {
                MessageBox.Show(" Duplicate Order of Payment Number ");
                return(false);
            }

            return(true);
        }
コード例 #2
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;
            }
        }