Example #1
0
        private void AddVoucher(object obj)
        {
            if (VSDetail.ProdId == 0)
            {
                MessageBox.Show("Please Select a Voucher first.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            else if (VSDetail.Quantity == 0)
            {
                MessageBox.Show("Please enter the quantity first.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            else if (VSDetailList.Any(x => x.ProdId == VSDetail.ProdId))
            {
                MessageBox.Show("Selected Voucher is already added.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            GenerateVoucher = !SelectedVoucherType.SkipVoucherGeneration;
            var vsDetail = new TParkingSalesDetails
            {
                FYID        = GlobalClass.FYID,
                PType       = 'V',
                ProdId      = VSDetail.ProdId,
                Description = VSDetail.Description,
                Quantity    = VSDetail.Quantity,
                QuantityStr = VSDetail.QuantityStr,
                Rate        = VSDetail.Rate,
                RateStr     = VSDetail.RateStr,
                Amount      = VSDetail.Amount,
                Taxable     = SelectedVoucherType.NonVat ? 0 : VSDetail.Amount,
                NonTaxable  = SelectedVoucherType.NonVat ? VSDetail.Amount :0,
                Remarks     = VSDetail.Remarks
            };

            vsDetail.VAT       = vsDetail.Taxable * GlobalClass.VAT / 100;
            vsDetail.NetAmount = vsDetail.Amount + vsDetail.VAT;
            VSDetailList.Add(vsDetail);
            VSDetail = new TParkingSalesDetails();
            VSDetail.PropertyChanged += VSDetail_PropertyChanged;
            FocusedElement            = (short)Focusable.VoucherType;
        }