Beispiel #1
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            (model as MCashDoc).DocumentType = ((int)docType).ToString();

            items = OnixWebServiceAPI.GetListAPI("GetCashDocList", "CASH_DOC_LIST", model.GetDbObject());
            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();

            foreach (CTable o in items)
            {
                MCashDoc v = null;
                if (docType == CashDocumentType.CashDocImport)
                {
                    v = new MCashDocIn(o);
                }
                else
                {
                    v = new MCashDocOut(o);
                }

                itemSources.Add(v);
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
Beispiel #2
0
        protected override MBaseModel createObject()
        {
            MCashDoc mv = null;

            if (docType == CashDocumentType.CashDocImport)
            {
                mv = new MCashDocIn(new CTable(""));
            }
            else if (docType == CashDocumentType.CashDocExport)
            {
                mv = new MCashDocOut(new CTable(""));
            }

            mv.CreateDefaultValue();
            mv.DocumentDate   = DateTime.Now;
            mv.DocumentType   = ((Int32)docType).ToString();
            mv.IsInternalDoc  = false;
            mv.DocumentStatus = ((int)CashDocumentStatus.CashDocPending).ToString();
            mv.AllowNegative  = CGlobalVariable.IsCashNegativeAllow();

            return(mv);
        }
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            //MSalePurchaseHistory mp = model as MSalePurchaseHistory;
            //mp.Category = eType;

            CTable tb = model.GetDbObject();

            items = OnixWebServiceAPI.GetCashTransactionList(tb);
            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MCashDoc v = new MCashDoc(o);
                v.IsEnabled = false;

                if (idx == 0)
                {
                    //Create one for balance forward
                    MCashDoc bfw = new MCashDoc(new CTable(""));
                    bfw.IsEnabled = false;

                    bfw.DocumentNo   = CLanguage.getValue("balance_forward");
                    bfw.DocumentDate = v.DocumentDate;
                    bfw.EndAmount    = v.BeginAmount;
                    itemSources.Add(bfw);
                }

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
        private void createInfoEntries()
        {
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_LABEL, "", "AccNo"));
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_TEXT_BOX, "AccountNo", ""));

            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_LABEL, "", "AccName"));
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_TEXT_BOX, "AccountName", ""));

            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_LABEL, "", "money_quantity"));
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_TEXT_BOX, "TotalAmountFmt", ""));

            MCashDoc     m = (MCashDoc)model;
            MCashAccount d = (MCashAccount)GetDefaultData();

            if (d != null)
            {
                m.AccountNo     = d.AccountNo;
                m.AccountName   = d.AccountName;
                m.CashAccountID = d.CashAccountID;
                m.TotalAmount   = d.TotalAmount;
            }
        }
Beispiel #5
0
        private void mnuContextMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mnu  = (sender as MenuItem);
            string   name = mnu.Name;

            if (name.Equals("mnuEdit"))
            {
                showEditWindow();
            }
            else if (name.Equals("mnuCopy"))
            {
                CUtil.EnableForm(false, ParentControl);
                CTable newobj = OnixWebServiceAPI.SubmitObjectAPI("CopyCashDoc", currentObj.GetDbObject());

                if (newobj != null)
                {
                    MCashDoc ivd = null;
                    if (docType == CashDocumentType.CashDocImport)
                    {
                        ivd = new MCashDocIn(newobj);
                    }
                    else
                    {
                        ivd = new MCashDocOut(newobj);
                    }

                    ItemAddedEvent(ivd, e);
                }
                else
                {
                    //Error here
                    CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null);
                }

                CUtil.EnableForm(true, ParentControl);
            }
        }
        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);
        }