public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevGroupId;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            //ArrayList keepTotal1 = copyTotalArray(groupSums);
            ArrayList keepTotal2 = copyTotalArray(sums);


            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            filterDrCrAmount(o);

            if (newh > 0)
            {
                String groupId = o.GetFieldValue(getGroupKey());
                if (row == 0)
                {
                    prevGroupId = groupId;
                }

                if (!groupId.Equals(prevGroupId))
                {
                    prevGroupId = groupId;
                    groupSum1   = groupSums;
                }

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums = sumDataTexts("L1", sums, temps);

                if (row == rowcount - 1)
                {
                    double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums);
                    newh = newh - h;
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                //groupSums = keepTotal1;
                sums        = keepTotal2;
                prevGroupId = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevKeyId;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(entitySums);
            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            populateTempFields(o);

            double h = 0.00;

            if (newh > 0)
            {
                String keyId = o.GetFieldValue("EMPLOYEE_CODE");

                if (row == 0)
                {
                    prevKeyId = keyId;
                }

                h = addNewDataRow(rowdef, rpp, "DATA_LEVEL1", "L1", row, o);
                //newh = newh - h;

                ArrayList temps = getColumnDataTexts("L1", row, o);
                nr.FillColumnsText(temps);

                sums       = sumDataTexts("L1", sums, temps);
                entitySums = sumDataTexts("L1", entitySums, temps);

                if (row == rowcount - 1)
                {
                    h    = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums);
                    newh = newh - h;
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                entitySums = keepTotal1;
                sums       = keepTotal2;
                prevKeyId  = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #3
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevEntityId;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(entitySums);
            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            populateTempFields(o);

            if (newh > 0)
            {
                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums       = sumDataTexts("L1", sums, temps);
                entitySums = sumDataTexts("L1", entitySums, temps);

                if (row == rowcount - 1)
                {
                    //=== End row
                    CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr1 = ft1.Clone();

                    ArrayList totals = displayTotalTexts("L1", sums, 1, "total");
                    ftr1.FillColumnsText(totals);

                    rpp.AddReportRow(ftr1);
                    newh = newh - ftr1.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                entitySums   = keepTotal1;
                sums         = keepTotal2;
                prevEntityId = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        private void addTotalRow(CReportDataProcessingProperty rpp, ArrayList sumArray)
        {
            CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr1 = ft1.Clone();

            ArrayList totals = displayTotalTexts("L1", sumArray, 1, "total");

            ftr1.FillColumnsText(totals);

            rpp.AddReportRow(ftr1);
        }
Example #5
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                filterDrCrAmount(o);

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums = sumDataTexts("L1", sums, temps);

                if (row == rowcount - 1)
                {
                    CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr1 = ft1.Clone();

                    ArrayList totals = displayTotalTexts("L1", sums, 1, "total");
                    ftr1.FillColumnsText(totals);

                    rpp.AddReportRow(ftr1);
                    newh = newh - ftr1.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;
                sums = keepTotal2;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();


            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                projSums = sumDataTexts("L1", projSums, temps);

                if (row == rowcount - 1)
                {
                    //=== End row
                    CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr1 = ft1.Clone();

                    rpp.AddReportRow(ftr1);
                    newh = newh - ftr1.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                //projSums = keepTotal1;
                //sums = keepTotal2;
                //prevProject = tmpPrevProject;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #7
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;

            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr = ft.Clone();

            MInventoryTransaction v = new MInventoryTransaction(o);

            double newh = AvailableSpace - nr.GetHeight();

            if (Parameter.GetFieldValue("COSTING_TYPE").Equals("MOVE"))
            {
                nr.FillColumnsText((row + 1).ToString(), v.DocumentDateFmt, v.DocumentNo, v.LocationName, v.LocationToName, v.ItemCode, v.ItemNameThai
                                   , CUtil.FormatNumber(v.ItemQuantity, "-"), CUtil.FormatNumber(v.ItemPrice, "-"), CUtil.FormatNumber(v.ItemAmount, "-"));

                totals += CUtil.StringToDouble(v.ItemAmount);
            }
            rpp.AddReportRow(nr);
            if (row == rowcount - 1)
            {
                newh = newh - ftr.GetHeight();
                if (newh > 0)
                {
                    ftr.FillColumnsText("", CLanguage.getValue("total"), "", "", "", "", "", "", "", CUtil.FormatNumber(totals.ToString(), "-"));
                    rpp.AddReportRow(ftr);

                    totals = 0;
                }
            }
            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #8
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            MCashAccount v = new MCashAccount(o);

            double newh = AvailableSpace - nr.GetHeight();

            nr.FillColumnsText((row + 1).ToString(), v.AccountNo, v.AccountName, v.BankName, v.BankBranchName,
                               v.TotalAmountFmt);

            totals[5] = totals[5] + CUtil.StringToDouble(v.TotalAmount);

            rpp.AddReportRow(nr);

            if (row == rowcount - 1)
            {
                //End row
                CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
                CRow ftr = ft.Clone();

                ftr.FillColumnsText(CLanguage.getValue("total"), "", "", "", "", CUtil.FormatNumber(totals[5].ToString()));

                rpp.AddReportRow(ftr);
                newh = AvailableSpace - ftr.GetHeight();
            }

            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #9
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            //ArrayList keepTotal1 = copyTotalArray(groupSums);
            //ArrayList keepTotal2 = copyTotalArray(sums);

            filterRecord(o);
            String rowType = o.GetFieldValue("ROW_TYPE");

            CRow r  = (CRow)rowdef[rowType];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                //groupSums = keepTotal1;
                //sums = keepTotal2;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;

            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            CRow r1  = (CRow)rowdef["DATA_LEVEL2"];
            CRow nr1 = r1.Clone();

            CRow r2  = (CRow)rowdef["DATA_LEVEL3"];
            CRow nr2 = r2.Clone();

            CRow ft      = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr     = ft.Clone();
            CRow ftrLast = ft.Clone();

            double newh = AvailableSpace;
            int    temp = 0;

            MCashDoc v = new MCashDoc(o);

            D = v.AccountNo;

            if (!H.Equals(D))
            {
                //v.IsBalanceForward = true;
                nr.FillColumnsText(v.AccountNo, v.AccountName, v.BankName, v.BankBranchName);
                nr1.FillColumnsText("",
                                    CLanguage.getValue("balance_forward"),
                                    "", "",
                                    CUtil.FormatNumber(v.BeginAmount_BalanceeFmt, "-"));

                Account = v.AccountNo;
                // v.IsBalanceForward = false;

                if ((!H.Equals("")) && (!H.Equals(D)))
                {
                    ftr.FillColumnsText("",
                                        CLanguage.getValue("total"),
                                        CUtil.FormatNumber(totals[0].ToString(), "-"),
                                        CUtil.FormatNumber(totals[1].ToString(), "-"),
                                        CUtil.FormatNumber(totals[2].ToString(), "-"));

                    newh = newh - ftr.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(ftr);

                        newh = newh - nr.GetHeight() - nr1.GetHeight();
                        if (newh > 0)
                        {
                            rpp.AddReportRow(nr);
                            rpp.AddReportRow(nr1);
                            temp++;

                            H = Account;

                            totals[0] = 0;
                            totals[1] = 0;
                            totals[2] = 0;

                            rowNo = 0;
                        }
                    }
                }
                else
                {
                    newh = newh - nr.GetHeight() - nr1.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(nr);
                        rpp.AddReportRow(nr1);
                        temp++;
                    }
                }
            }

            if (newh > 0)
            {
                newh = newh - nr2.GetHeight();
                if (newh > 0)
                {
                    rowNo++;
                    nr2.FillColumnsText(
                        CUtil.FormatInt(rowNo.ToString()),
                        v.DocumentDateFmt,
                        CUtil.FormatNumber(v.InAmount_BalnceFmt, "-"),
                        CUtil.FormatNumber(v.OutAmount_BalanceFmt, "-"),
                        CUtil.FormatNumber(v.EndAmount_BalanceFmt, "-"));

                    totals[0] += CUtil.StringToDouble(v.InAmount_BalnceFmt);
                    totals[1] += CUtil.StringToDouble(v.OutAmount_BalanceFmt);
                    totals[2]  = CUtil.StringToDouble(v.EndAmount_BalanceFmt);
                    rpp.AddReportRow(nr2);
                }
            }

            if (newh > 0)
            {
                if (row == rowcount - 1)
                {
                    ftrLast.FillColumnsText("",
                                            CLanguage.getValue("total"),
                                            CUtil.FormatNumber(totals[0].ToString(), "-"),
                                            CUtil.FormatNumber(totals[1].ToString(), "-"),
                                            CUtil.FormatNumber(totals[2].ToString(), "-"));

                    newh = newh - ftrLast.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(ftrLast);

                        rowNo = 0;

                        totals[0] = 0;
                        totals[1] = 0;
                        totals[2] = 0;
                    }
                }

                Account = v.AccountNo;

                H = Account;
            }

            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
                rpp.TempNotRowDetails = temp;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #11
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevProject;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(projSums);
            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                filterDrCrAmount(o);
                populatePaymentIndex(o);

                String projCd = o.GetFieldValue(getGroupKey());
                if (row == 0)
                {
                    prevProject = projCd;
                }

                String rptType = Parameter.GetFieldValue("REPORT_TYPE");
                if (!projCd.Equals(prevProject))
                {
                    prevProject = projCd;

                    CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr = ft.Clone();

                    ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total");
                    ftr.FillColumnsText(projTotals);

                    if (rptType.Equals("2") || rptType.Equals("3"))
                    {
                        //Only by project report
                        rpp.AddReportRow(ftr);
                        newh = newh - ftr.GetHeight();
                    }

                    //Reset
                    projSums = new ArrayList();
                }

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums     = sumDataTexts("L1", sums, temps);
                projSums = sumDataTexts("L1", projSums, temps);

                if (row == rowcount - 1)
                {
                    //=== Project
                    CRow ft0  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr0 = ft0.Clone();

                    ArrayList projTotals = displayTotalTexts("L1", projSums, 1, "total");
                    ftr0.FillColumnsText(projTotals);

                    if (rptType.Equals("2") || rptType.Equals("3"))
                    {
                        //Only by project report
                        rpp.AddReportRow(ftr0);
                        newh = newh - ftr0.GetHeight();
                    }

                    //=== End row
                    CRow ft1  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr1 = ft1.Clone();

                    ArrayList totals = displayTotalTexts("L1", sums, 1, "total");
                    ftr1.FillColumnsText(totals);

                    rpp.AddReportRow(ftr1);
                    newh = newh - ftr1.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                projSums    = keepTotal1;
                sums        = keepTotal2;
                prevProject = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            ArrayList arr = OnixWebServiceAPI.GetInventoryBalanceSummaryList(Parameter);

            //string orderArr = string.Empty;
            //foreach (CTable o in arr)
            //{
            //    orderArr += o.GetFieldValue("ITEM_NAME_THAI");
            //    orderArr += "," + o.GetFieldValue("ITEM_ID");
            //    orderArr += "," + o.GetFieldValue("DESCRIPTION");
            //    orderArr += "," + o.GetFieldValue("LOCATION_ID");
            //    orderArr += "," + o.GetFieldValue("BALANCE_DATE");
            //    orderArr += "\n";
            //}
            //MessageBox.Show(orderArr);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                    if (property.TempNotRowDetails > 0)
                    {
                        ConstructUIRows(area, property);
                    }
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }
                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevKey;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(groupSums);
            ArrayList keepTotal2 = copyTotalArray(sums);


            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            manipulateRow(o);

            if (newh > 0)
            {
                String groupKey = getGroupKey(o);
                if (row == 0)
                {
                    prevKey = groupKey;
                }

                if (!groupKey.Equals(prevKey) || (row == 0))
                {
                    if (row != 0)
                    {
                        CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
                        CRow ftr = ft.Clone();

                        ArrayList projTotals = displayTotalTexts("L1", groupSums, 1, "total");
                        ftr.FillColumnsText(projTotals);

                        rpp.AddReportRow(ftr);
                        newh = newh - ftr.GetHeight();

                        groupSums = new ArrayList();
                    }

                    prevKey = groupKey;

                    CRow      dt0       = (CRow)rowdef["DATA_LEVEL0"];
                    CRow      dtr0      = dt0.Clone();
                    ArrayList tempRows0 = getColumnDataTexts("L0", 0, o);
                    dtr0.FillColumnsText(tempRows0);

                    rpp.AddReportRow(dtr0);
                    newh = newh - dtr0.GetHeight();
                }

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums      = sumDataTexts("L1", sums, temps);
                groupSums = sumDataTexts("L1", groupSums, temps);

                if (row == rowcount - 1)
                {
                    double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", groupSums);
                    newh = newh - h;

                    h    = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums);
                    newh = newh - h;
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                groupSums = keepTotal1;
                sums      = keepTotal2;
                prevKey   = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #14
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;

            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            CRow r1  = (CRow)rowdef["DATA_LEVEL2"];
            CRow nr1 = r1.Clone();

            CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr = ft.Clone();

            MEntity v = new MEntity(o);

            double newh = AvailableSpace - nr.GetHeight();

            D = v.EntityType + v.EntityGroup;

            if (!H.Equals(D))// (Item != v.ItemCode && Location != v.LocationID)
            {
                nr.FillColumnsText(v.EntityTypeName, v.EntityGroupName);
                //nr2.FillColumnsText("", CLanguage.getValue("balance_forward"), "", "", "", "", "", v.EndQuantity, v.EndAmountAvg, "");
                custType  = v.EntityType;
                custGroup = v.EntityGroup;

                if ((!H.Equals("")) && (!H.Equals(D)))
                {
                    ftr.FillColumnsText(CLanguage.getValue("total"), CUtil.FormatNumber(totalFoot.ToString()), "");
                    rpp.AddReportRow(ftr);
                    rpp.AddReportRow(nr);
                    H = custType + custGroup;

                    rowNo     = 0;
                    totalFoot = 0;
                }
                else
                {
                    rpp.AddReportRow(nr);
                }
            }
            rowNo++;
            totalFoot++;
            nr1.FillColumnsText(CUtil.FormatInt(rowNo.ToString()), v.EntityCode, v.EntityName, v.Phone);
            //if (Parameter.GetFieldValue("COSTING_TYPE").Equals("AVG"))
            //{
            //    nr.FillColumnsText((row + 1).ToString(), v.DocDate, v.DocNo, v.InQuantityMovement, v.OutQuantityMovement, v.InAmountMovementAvg, v.OutAmountMovementAvg, v.EndQuantity, v.EndAmountAvg, v.UnitPriceAVG);
            //    totals[0] = totals[0] + double.Parse(v.InQuantityMovement);
            //    totals[1] = totals[1] + double.Parse(v.OutQuantityMovement);
            //    totals[2] = totals[2] + double.Parse(v.InAmountMovementAvg);
            //    totals[3] = totals[3] + double.Parse(v.OutAmountMovementAvg);
            //    totals[4] = double.Parse(v.EndQuantity);
            //    totals[5] = double.Parse(v.EndAmountAvg);
            //    totals[6] = double.Parse(v.UnitPriceAVG);
            //}


            rpp.AddReportRow(nr1);

            if (row == rowcount - 1) //(H != "" && H != D) ||
            {
                ftr.FillColumnsText(CLanguage.getValue("total"), CUtil.FormatNumber(totalFoot.ToString()), "");
                rpp.AddReportRow(ftr);

                rowNo     = 0;
                totalFoot = 0;
                newh      = AvailableSpace - ftr.GetHeight();
            }

            custType  = v.EntityType;
            custGroup = v.EntityGroup;
            H         = custType + custGroup;

            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            String tmpPrevKey = prevEntityId;
            int    rowcount   = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            ArrayList keepTotal1 = copyTotalArray(entitySums);
            ArrayList keepTotal2 = copyTotalArray(sums);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            double amt    = CUtil.StringToDouble(o.GetFieldValue("TX_AMOUNT"));
            String txType = o.GetFieldValue("TX_TYPE");

            o.SetFieldValue("IN_AMOUNT", "0");
            o.SetFieldValue("OUT_AMOUNT", amt.ToString());
            if (txType.Equals("I"))
            {
                o.SetFieldValue("IN_AMOUNT", amt.ToString());
                o.SetFieldValue("OUT_AMOUNT", "0");
            }


            if (newh > 0)
            {
                String entityId = o.GetFieldValue(getGroupKey());
                if (row == 0)
                {
                    prevEntityId = entityId;

                    double h = addNewDataRow(rowdef, rpp, "DATA_LEVEL0", "L0", row, o);
                    newh = newh - h;
                }

                if (!entityId.Equals(prevEntityId))
                {
                    prevEntityId = entityId;

                    double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", entitySums);
                    newh = newh - h;

                    //Reset
                    entitySums = new ArrayList();

                    h    = addNewDataRow(rowdef, rpp, "DATA_LEVEL0", "L0", row, o);
                    newh = newh - h;
                }

                ArrayList temps = getColumnDataTexts("L1", row + 1, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums       = sumDataTexts("L1", sums, temps);
                entitySums = sumDataTexts("L1", entitySums, temps);

                if (row == rowcount - 1)
                {
                    double h = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", entitySums);
                    newh = newh - h;

                    h    = addNewFooterRow(rowdef, rpp, "FOOTER_LEVEL1", "L1", "total", sums);
                    newh = newh - h;
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                entitySums   = keepTotal1;
                sums         = keepTotal2;
                prevEntityId = tmpPrevKey;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #16
0
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            double[] keepTotal2 = copyTotalArray(totals);

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double amt = CUtil.StringToDouble(o.GetFieldValue("PAID_AMOUNT"));

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                String pmtType  = o.GetFieldValue("PAYMENT_TYPE");
                String chequeNo = "";
                String bankName = "";
                if (pmtType.Equals("4"))
                {
                    //Cheque
                    chequeNo = o.GetFieldValue("CHEQUE_NO");
                    bankName = o.GetFieldValue("CHEQUE_TO_BANK_NAME");
                }
                else
                {
                    bankName = o.GetFieldValue("BANK_NAME");
                }

                String refDocField = "REF_PO_NO";
                if (extParam.GetFieldValue("CATEGORY").Equals("2"))
                {
                    refDocField = "REF_DOCUMENT_NO";
                }

                nr.FillColumnsText((row + 1).ToString(),
                                   CUtil.DateTimeToDateString(CUtil.InternalDateToDate(o.GetFieldValue("DOCUMENT_DATE"))),
                                   o.GetFieldValue("DOCUMENT_NO"),
                                   o.GetFieldValue(refDocField),
                                   o.GetFieldValue("ENTITY_NAME"),
                                   bankName,
                                   chequeNo,
                                   CUtil.FormatNumber(amt.ToString()));

                totals[7] = totals[7] + amt;


                rpp.AddReportRow(nr);

                if (row == rowcount - 1)
                {
                    //End row
                    CRow ft  = (CRow)rowdef["FOOTER_LEVEL1"];
                    CRow ftr = ft.Clone();

                    ftr.FillColumnsText(CLanguage.getValue("total"), "", "", "", "", "", "", CUtil.FormatNumber(totals[7].ToString()));

                    rpp.AddReportRow(ftr);
                    newh = newh - ftr.GetHeight();
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;

                //พวก sum ทั้งหลายจะถูกคืนค่ากลับไปด้วย เพราะถูกบวกไปแล้ว
                totals = keepTotal2;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #17
0
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            ArrayList arr = OnixWebServiceAPI.GetCashAccountList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;
            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            if (isSkipRow(o))
            {
                //In case the last record is skipped

                if (row == rowcount - 1)
                {
                    addTotalRow(rpp, sums);
                }

                //Do Nothing
                return(rpp);
            }

            ArrayList keepTotal2 = copyTotalArray(sums);

            rowProcess++;

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            double newh = AvailableSpace - nr.GetHeight();

            if (newh > 0)
            {
                filterDrCrAmount(o);

                String refDocNo = o.GetFieldValue("REF_DOCUMENT_NO");
                if (refDocNo.Equals(""))
                {
                    refDocNo = o.GetFieldValue("ACTUAL_INVOICE_NO");
                }
                o.SetFieldValue("REF_DOCUMENT_NO", refDocNo);

                String refDocDate = o.GetFieldValue("REF_DOCUMENT_DATE");
                if (refDocDate.Equals(""))
                {
                    refDocDate = o.GetFieldValue("ACTUAL_INVOICE_DATE");
                }
                o.SetFieldValue("REF_DOCUMENT_DATE", refDocDate);

                ArrayList temps = getColumnDataTexts("L1", rowProcess, o);
                nr.FillColumnsText(temps);
                rpp.AddReportRow(nr);

                sums = sumDataTexts("L1", sums, temps);

                if (row == rowcount - 1)
                {
                    addTotalRow(rpp, sums);
                }
            }

            if (newh < 1)
            {
                rpp.IsNewPageRequired = true;
                sums = keepTotal2;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }
Example #19
0
        public override FixedDocument CreateFixedDocument()
        {
            FixedDocument fd = new FixedDocument();

            ReportProgressUpdate updateFunc = GetProgressUpdateFunc();
            ReportStatusUpdate   doneFunc   = GetProgressDoneFunc();

            fd.DocumentPaginator.PageSize = PageSize;

            if (doneFunc != null)
            {
                doneFunc(false, false);
            }

            if (Parameter.GetFieldValue("COSTING_TYPE").Equals("MOVE"))
            {
                Parameter.SetFieldValue("DOCUMENT_TYPE", "3");
            }
            ArrayList arr = OnixWebServiceAPI.GetInventoryTransactionList(Parameter);

            if (arr == null)
            {
                return(fd);
            }

            int         cnt  = arr.Count;
            UReportPage area = null;

            createRowTemplates();
            int i = 0;

            Size areaSize = GetAreaSize();

            AvailableSpace = areaSize.Height;

            CReportDataProcessingProperty property = null;

            #region First Header Case : Row is 0
            if (arr.Count == 0)
            {
                arr.Add(Parameter); //add for show header and first row empty
            }
            #endregion
            while (i < arr.Count)
            {
                CTable o = (CTable)arr[i];

                if ((i == 0) || (property.IsNewPageRequired))
                {
                    AvailableSpace = areaSize.Height;

                    CurrentPage++;

                    FixedPage fp = new FixedPage();
                    fp.Margin = Margin;

                    PageContent pageContent = new PageContent();
                    ((System.Windows.Markup.IAddChild)pageContent).AddChild(fp);

                    fd.Pages.Add(pageContent);
                    area = initNewArea(areaSize);

                    pages.Add(area);
                    fp.Children.Add(area);
                }

                property = DataToProcessingProperty(o, arr, i);
                if (property.IsNewPageRequired)
                {
                    //Do not create row if that row caused new page flow
                    //But create it in the next page instead
                    i--;
                }
                else
                {
                    ConstructUIRows(area, property);
                }

                if (updateFunc != null)
                {
                    updateFunc(i, cnt);
                }

                i++;
            }

            if (doneFunc != null)
            {
                doneFunc(true, false);
            }

            keepFixedDoc = fd;
            return(fd);
        }
        public override CReportDataProcessingProperty DataToProcessingProperty(CTable o, ArrayList rows, int row)
        {
            int rowcount = rows.Count;

            CReportDataProcessingProperty rpp = new CReportDataProcessingProperty();

            CRow r1  = (CRow)rowdef["DATA_LEVEL2"];
            CRow nr1 = r1.Clone();

            CRow r  = (CRow)rowdef["DATA_LEVEL1"];
            CRow nr = r.Clone();

            CRow r2  = (CRow)rowdef["DATA_LEVEL3"];
            CRow nr2 = r2.Clone();

            CRow ft      = (CRow)rowdef["FOOTER_LEVEL1"];
            CRow ftr     = ft.Clone();
            CRow ftrLast = ft.Clone();

            MInventoryCurrentBalance v = new MInventoryCurrentBalance(o);

            double newh = AvailableSpace;
            int    temp = 0;

            D = v.ItemCode + v.LocationID;

            if (!H.Equals(D))            // (Item != v.ItemCode && Location != v.LocationID)
            {
                nr1.FillColumnsText(v.ItemCode, v.ItemName, v.LocationName);
                if (Parameter.GetFieldValue("COSTING_TYPE").Equals("AVG"))
                {
                    nr2.FillColumnsText("", CLanguage.getValue("balance_forward"), "", "", "", "", CUtil.FormatNumber(v.BeginQuantityFmt, "-"), CUtil.FormatNumber(v.BeginAmountAvgFmt, "-"), "");
                }
                else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("FIFO"))
                {
                    nr2.FillColumnsText("", CLanguage.getValue("balance_forward"), "", "", "", "", CUtil.FormatNumber(v.BeginQuantityFmt, "-"), CUtil.FormatNumber(v.BeginAmountFifoFmt, "-"), "");
                }
                Item     = v.ItemCode;
                Location = v.LocationID;

                if ((!H.Equals("")) && (!H.Equals(D)))
                {
                    ftr.FillColumnsText("", CLanguage.getValue("total"), CUtil.FormatNumber(totals[0].ToString(), "-"), CUtil.FormatNumber(totals[2].ToString(), "-")
                                        , CUtil.FormatNumber(totals[1].ToString(), "-"), CUtil.FormatNumber(totals[3].ToString(), "-")
                                        , CUtil.FormatNumber(totals[4].ToString(), "-"), CUtil.FormatNumber(totals[5].ToString(), "-"), CUtil.FormatNumber(totals[6].ToString(), "-"));

                    newh = newh - ftr.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(ftr);


                        newh = newh - nr1.GetHeight() - nr2.GetHeight();
                        if (newh > 0)
                        {
                            rpp.AddReportRow(nr1);
                            rpp.AddReportRow(nr2);
                            temp++;

                            H = Item + Location;

                            totals[0] = 0;
                            totals[1] = 0;
                            totals[2] = 0;
                            totals[3] = 0;
                            totals[4] = 0;
                            totals[5] = 0;
                            totals[6] = 0;

                            rowNo = 0;
                        }
                    }
                }
                else
                {
                    newh = newh - nr1.GetHeight() - nr2.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(nr1);
                        rpp.AddReportRow(nr2);
                        temp++;
                    }
                }
            }

            if (newh > 0)
            {
                newh = newh - nr.GetHeight();
                if (newh > 0)
                {
                    if (Parameter.GetFieldValue("COSTING_TYPE").Equals("AVG")) //SUMAVG
                    {
                        rowNo++;
                        nr.FillColumnsText(CUtil.FormatInt(rowNo.ToString()), v.BalanceDateFmt, CUtil.FormatNumber(v.InQuantityFmt, "-"), CUtil.FormatNumber(v.InAmountAvgFmt, "-")
                                           , CUtil.FormatNumber(v.OutQuantityFmt, "-"), CUtil.FormatNumber(v.OutAmountAvgFmt, "-"), CUtil.FormatNumber(v.EndQuantityFmt, "-")
                                           , CUtil.FormatNumber(v.EndAmountAvgFmt, "-"), CUtil.FormatNumber(v.EndUnitPriceAVGFmt, "-"));

                        totals[0] += CUtil.StringToDouble(v.InQuantity);
                        totals[1] += CUtil.StringToDouble(v.OutQuantity);
                        totals[2] += CUtil.StringToDouble(v.InAmountAvg);
                        totals[3] += CUtil.StringToDouble(v.OutAmountAvg);
                        totals[4]  = CUtil.StringToDouble(v.EndQuantity);
                        totals[5]  = CUtil.StringToDouble(v.EndAmountAvg);
                        totals[6]  = CUtil.StringToDouble(v.EndUnitPriceAVG);
                    }
                    else if (Parameter.GetFieldValue("COSTING_TYPE").Equals("FIFO"))//SUMFIFO
                    {
                        rowNo++;
                        nr.FillColumnsText(CUtil.FormatInt(rowNo.ToString()), v.BalanceDateFmt, CUtil.FormatNumber(v.InQuantityFmt, "-"), CUtil.FormatNumber(v.InAmountFifoFmt, "-")
                                           , CUtil.FormatNumber(v.OutQuantityFmt, "-"), CUtil.FormatNumber(v.OutAmountFifoFmt, "-"), CUtil.FormatNumber(v.EndQuantityFmt, "-")
                                           , CUtil.FormatNumber(v.EndAmountFifoFmt, "-"), CUtil.FormatNumber(v.EndUnitPriceFIFOFmt, "-"));

                        totals[0] += CUtil.StringToDouble(v.InQuantity);
                        totals[1] += CUtil.StringToDouble(v.OutQuantity);
                        totals[2] += CUtil.StringToDouble(v.InAmountFifo);
                        totals[3] += CUtil.StringToDouble(v.OutAmountFifo);
                        totals[4]  = CUtil.StringToDouble(v.EndQuantity);
                        totals[5]  = CUtil.StringToDouble(v.EndAmountFifo);
                        totals[6]  = CUtil.StringToDouble(v.EndUnitPriceFIFO);
                    }
                    rpp.AddReportRow(nr);
                }
            }

            if (newh > 0)
            {
                if (row == rowcount - 1) //(H != "" && H != D) ||
                {
                    ftrLast.FillColumnsText("", CLanguage.getValue("total"), CUtil.FormatNumber(totals[0].ToString(), "-"), CUtil.FormatNumber(totals[2].ToString(), "-")
                                            , CUtil.FormatNumber(totals[1].ToString(), "-"), CUtil.FormatNumber(totals[3].ToString(), "-")
                                            , CUtil.FormatNumber(totals[4].ToString(), "-"), CUtil.FormatNumber(totals[5].ToString(), "-"), CUtil.FormatNumber(totals[6].ToString(), "-"));

                    newh = newh - ftrLast.GetHeight();
                    if (newh > 0)
                    {
                        rpp.AddReportRow(ftrLast);

                        totals[0] = 0;
                        totals[1] = 0;
                        totals[2] = 0;
                        totals[3] = 0;
                        totals[4] = 0;
                        totals[5] = 0;
                        totals[6] = 0;
                    }
                }

                Item     = v.ItemCode;
                Location = v.LocationID;
                H        = Item + Location;
            }

            if (newh < 0)
            {
                rpp.IsNewPageRequired = true;
                rpp.TempNotRowDetails = temp;
            }
            else
            {
                AvailableSpace = newh;
            }

            return(rpp);
        }