Example #1
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 = new MCashDocXfer(newobj);
                    ItemAddedEvent(ivd, e);
                }
                else
                {
                    //Error here
                    CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null);
                }

                CUtil.EnableForm(true, ParentControl);
            }
        }
Example #2
0
        private void showEditWindow()
        {
            if (!CHelper.VerifyAccessRight("CASH_XFER_VIEW"))
            {
                return;
            }

            MCashDocXfer v = (MCashDocXfer)currentObj;

            String winName = "WinAddEditCashExternalXfer";

            if (v.CashXferType.Equals("1"))
            {
                winName = "WinAddEditCashTransfer";
            }

            String caption = CLanguage.getValue("edit") + " " + CLanguage.getValue("Trans");

            CWinLoadParam param = new CWinLoadParam();

            param.Caption           = caption;
            param.GenericType       = ((int)docType).ToString();
            param.Mode              = "E";
            param.ParentItemSources = itemSources;
            param.ActualView        = currentObj;
            FactoryWindow.ShowWindow(winName, param);
        }
        private void addReturnDocItems(ArrayList items)
        {
            MCashDocXfer mv = (MCashDocXfer)vw;

            //To prevent the duplication selection
            Hashtable hash  = CUtil.ObserableCollectionToHash(mv.XferItems, "AccountDocPaymentID");
            double    total = 0.00;

            foreach (MAccountDocPayment ai in items)
            {
                if (hash.ContainsKey(ai.AccountDocPaymentID))
                {
                    continue;
                }

                MCashDocXferDetail di = new MCashDocXferDetail(new CTable(""));
                di.SetDbObject(ai.GetDbObject().CloneAll());
                di.ExtFlag = "A";

                total = total + CUtil.StringToDouble(di.PaidAmount);
                mv.AddXferItem(di);
            }

            mv.TotalAmount = total.ToString();
        }
        private void cbxCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            MCashDocXfer mv = (MCashDocXfer)vw;

            if (!isInLoad)
            {
                mv.CalculateTransferTotal();
            }

            mv.IsModified = true;
        }
Example #5
0
        protected override bool postValidate()
        {
            MCashDocXfer mv = (MCashDocXfer)vw;

            if (mv.FromAccountID.Equals(mv.ToAccountID))
            {
                CHelper.ShowErorMessage("", "ERROR_XFER_SAME_ACCOUNT", null);
                return(false);
            }

            return(true);
        }
Example #6
0
        protected override MBaseModel createObject()
        {
            MCashDocXfer mv = new MCashDocXfer(new CTable(""));

            mv.CashXferType  = "1";
            mv.DocumentType  = loadParam.GenericType;
            mv.AllowNegative = CGlobalVariable.IsInventoryNegativeAllow();
            mv.DocumentDate  = DateTime.Now;
            mv.CreateDefaultValue();

            return(mv);
        }
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();

            MCashDocXfer v = new MCashDocXfer(o);

            double newh = AvailableSpace - nr.GetHeight();

            nr.FillColumnsText((row + 1).ToString(), v.DocumentNo, v.DocumentDateFmt, v.FromAccountNo, v.ToAccountNo, v.TotalAmountFmt,
                               v.DocumentStatusDesc, v.Note);

            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 #8
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            (model as MCashDoc).DocumentType = ((int)CashDocumentType.CashDocXfer).ToString();

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

            itemSources.Clear();

            foreach (CTable o in items)
            {
                MCashDocXfer v = null;
                v = new MCashDocXfer(o);

                itemSources.Add(v);
            }

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

            return(tuple);
        }