private void LoadData()
        {
            //isInLoad = true;
            this.Title = Caption;

            CTable t = new CTable("");

            vw = new MPaymentCriteria(t);
            vw.CreateDefaultValue();

            DataContext = vw;

            CUtil.EnableForm(false, this);

            if (Mode.Equals("E"))
            {
                CTable newDB = actualView.GetDbObject().Clone();
                vw.SetDbObject(newDB);
            }
            else
            {
                vw.VatPercent = CGlobalVariable.GetGlobalVariableValue("VAT_PERCENTAGE");
                vw.WhPercent  = "3";
            }

            vw.NotifyAllPropertiesChanged();

            vw.IsModified = false;
            CUtil.EnableForm(true, this);
            //isInLoad = false;
        }
        public void DisplayQR()
        {
            MAuxilaryDoc ad = (dataSource as MAuxilaryDoc);

            string ppid = ad.PromptPayID;

            if (string.IsNullOrEmpty(ppid))
            {
                return;
            }

            var items = ad.PaymentCriteriaes;

            if ((items == null) || (items.Count <= 0))
            {
                uPromptPayQR.Amount = "0.00";
            }
            else
            {
                MPaymentCriteria mp = items[items.Count - 1];
                uPromptPayQR.Amount = mp.RemainAmount;
            }

            uPromptPayQR.PropmtPayID = ppid;
            uPromptPayQR.GenerateQR();
        }
        private Boolean validatePaymentCriteria <T>(ObservableCollection <T> collection, TabItem titem, Boolean chkCnt) where T : MBaseModel
        {
            int    idx   = 0;
            int    cnt   = 0;
            double total = 0.00;

            foreach (MBaseModel t in collection)
            {
                MPaymentCriteria c = (MPaymentCriteria)t;

                idx++;

                if (c.IsEmpty)
                {
                    CHelper.ShowErorMessage(idx.ToString(), "ERROR_SELECTION_TYPE", null);
                    titem.IsSelected = true;
                    return(false);
                }

                double pct = CUtil.StringToDouble(c.Percent);
                total = total + pct;

                cnt++;
            }

            if ((cnt <= 0) && chkCnt)
            {
                CHelper.ShowErorMessage(idx.ToString(), "ERROR_ITEM_COUNT", null);
                titem.IsSelected = true;
                return(false);
            }

            return(true);
        }
예제 #4
0
        private void cmdPaymentDelete_Click(object sender, RoutedEventArgs e)
        {
            MPaymentCriteria pp = (MPaymentCriteria)(sender as Button).Tag;

            vw.RemovePaymentCriteria(pp);

            vw.IsModified = true;
        }
예제 #5
0
        private Boolean validatePaymentCriteria <T>(ObservableCollection <T> collection, TabItem titem, Boolean chkCnt) where T : MBaseModel
        {
            int    idx   = 0;
            int    cnt   = 0;
            double total = 0.00;

            foreach (MBaseModel t in collection)
            {
                MPaymentCriteria c = (MPaymentCriteria)t;

                idx++;

                if (c.IsEmpty)
                {
                    CHelper.ShowErorMessage(idx.ToString(), "ERROR_SELECTION_TYPE", null);
                    titem.IsSelected = true;
                    return(false);
                }

                double pct = CUtil.StringToDouble(c.Percent);
                total = total + pct;

                cnt++;
            }

            if ((cnt <= 0) && chkCnt)
            {
                CHelper.ShowErorMessage(idx.ToString(), "ERROR_ITEM_COUNT", null);
                titem.IsSelected = true;
                return(false);
            }

            if (cnt > 0)
            {
                if (!vw.PmtVatAmtFmt.Equals(vw.VatAmtFmt))
                {
                    String temp = String.Format("{0} != {1}", vw.PmtVatAmtFmt, vw.VatAmtFmt);

                    Boolean result = CHelper.AskConfirmMessage(temp, "ERROR_VAT_DIFFERENT");
                    return(result);
                }
            }

            return(true);
        }
        private void createInfoEntries()
        {
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_LABEL, "", "supplier_code"));
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_TEXT_BOX, "EntityCode", ""));

            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_LABEL, "", "supplier_name"));
            AddInfoControl(new CCriteriaEntry(CriteriaEntryType.ENTRY_TEXT_BOX, "EntityName", ""));

            MPaymentCriteria m = (MPaymentCriteria)model;
            MAccountDoc      d = (MAccountDoc)GetDefaultData();

            if (d != null)
            {
                m.IsIncludable     = false;
                m.EntityCode       = d.EntityCode;
                m.EntityName       = d.EntityName;
                m.EntityID         = d.EntityId;
                m.DocumentType     = eType;
                m.PoInvoiceRefType = "2";
            }
        }
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            CTable tb = model.GetDbObject();

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

            itemSources.Clear();
            int idx = 0;

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

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

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

            return(tuple);
        }
예제 #8
0
 public CPaymentCriteria(MPaymentCriteria di)
 {
     mi = di;
 }