コード例 #1
0
        private void changeItemEvent(bool IsbarcodeChangeEvent = false)
        {
            _productObj = new Product(SelectedProductMCODE, true);
            if (_productObj.AlternateUnits != null && _productObj.AlternateUnits.Count > 0)
            {
                SelectedAltUnit = _productObj.AlternateUnits.First();
            }
            _BARCODE = _productObj.BARCODE;

            if (TrnProdObj == null)
            {
                TrnProdObj = new TrnProd();
                TrnProdObj.PropertyChanged += TrnProdObj_PropertyChanged;
            }
            TrnProdObj.MENUCODE = _productObj.MENUCODE;
            TrnProdObj.ITEMDESC = _productObj.DESCA;
            TrnProdObj.MCODE    = _productObj.MCODE;

            TrnProdObj.ALTUNIT = _productObj.BASEUNIT;
            TrnProdObj.UNIT    = SelectedAltUnit.ALTUNIT;
            // TrnProdObj.RATE = _productObj.RATE_A;
            TrnProdObj.REALRATE        = TrnProdObj.RATE;
            TrnProdObj.ISVAT           = _productObj.VAT;
            TrnProdObj.ISSERVICECHARGE = _productObj.HASSERVICECHARGE;

            OnPropertyChanged("productObj");
            OnPropertyChanged("BARCODE");

            if (IsbarcodeChangeEvent == false)
            {
                TrnProdObj.BC = _BARCODE;
            }
        }
コード例 #2
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                DataTable dt = RequisitionEntryViewModel.getExcelDataToDataTable();
                if (dt.Columns["Barcode"] == null || dt.Columns["Quantity"] == null || dt.Columns["Warehouse"] == null)
                {
                    MessageBox.Show("Invalid excel format.", "Stock Settlement", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                using (SqlConnection conn = new SqlConnection(GlobalClass.DataConnectionString))
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (row["Barcode"] == null || row["Barcode"].ToString() == string.Empty)
                        {
                            continue;
                        }
                        var     Product = conn.Query(@"SELECT A.BCODE, A.MCODE, A.UNIT, A.SUPCODE, A.SRATE, B.DESCA, B.MENUCODE, B.BASEUNIT, B.PRATE_A, B.PRATE_B, B.RATE_A, B.VAT
FROM BARCODE A inner join Menuitem B on A.mcode = B.mcode WHERE A.BCODE = '" + row["Barcode"] + "'").FirstOrDefault();
                        TrnProd tPod    = new TrnProd
                        {
                            MCODE     = Product.MCODE,
                            MENUCODE  = Product.MENUCODE,
                            ITEMDESC  = Product.DESCA,
                            BC        = Product.BCODE,
                            UNIT      = Product.UNIT,
                            RATE      = Product.SRATE,
                            REALRATE  = Product.SRATE,
                            ISVAT     = Product.VAT,
                            Quantity  = Convert.ToDecimal(row["Quantity"]),
                            WAREHOUSE = row["Warehouse"].ToString(),
                        };
                        tPod.CalculateNormal();
                        App.Current.Dispatcher.Invoke((Action) delegate // <--- HERE
                        {
                            TrnMainBaseModelObj.ProdList.Add(tPod);
                        });
                    }
                    TrnMainBaseModelObj.ReCalculateBill();
                }
            }
            catch (Exception ex)
            {
                GlobalClass.ProcessError(ex, "Report Load Failure");
            }
        }
コード例 #3
0
        public override void NewMethod(object obj)
        {
            UndoMethod(null);
            string Div;

            Tmode = "NEW";
            TrnMainBaseModelObj.DIVISION = string.IsNullOrEmpty(TrnMainBaseModelObj.DIVISION) ? GlobalClass.DIVISION : TrnMainBaseModelObj.DIVISION;
            TrnMainBaseModelObj.TRNDATE  = DateTime.Now;
            TrnProdObj = new TrnProd();
            TrnProdObj.PropertyChanged += TrnProdObj_PropertyChanged;
            string vnum     = string.Empty;
            string vno      = string.Empty;
            string chalanNo = string.Empty;

            GlobalClass.GetBillSequences("StockSettlement", TrnMainBaseModelObj.VoucherPrefix, TrnMainBaseModelObj.VoucherName, TrnMainBaseModelObj.VoucherPrefix, ref vno, ref chalanNo, ref vnum);
            TrnMainBaseModelObj.VCHRNO = vno;
            TrnMainBaseModelObj.VNUM   = vnum;
            SelectedWarehouse          = GlobalClass.Warehouse;
            //FocusedElement = (short)FocusElements.RefNo;
        }