public override int GetHashCode()
 {
     if (BillNo != null)
     {
         return(BillNo.GetHashCode());
     }
     else
     {
         return(base.GetHashCode());
     }
 }
示例#2
0
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     VendorName.Clear();
     BillNo.Clear();
     OrderNo.Clear();
     BillDate.Clear();
     DueDate.Clear();
     SubTotal.Clear();
     Adjustment.Clear();
     Total.Clear();
     CustNotes.Clear();
     TermAndCondns.Clear();
 }
示例#3
0
        private void CreateNumber(string prefix, string center, int fromValue, int toValue, BillNoRule entity)
        {
            int strLenght = toValue.ToString().Length;

            for (int i = fromValue; i <= toValue; i++)
            {
                string number = i.ToString().PadLeft(strLenght, '0');

                BillNo doc = BillNo.Create();
                doc.BillNoID     = prefix + center + number; //单号
                doc.BillNoState  = BillNoSatetEnum.UnCite;   //默认 未引用
                doc.BillNoRuleID = entity;
            }
            entity.IsCompile = true;
        }
        private async Task CreateBill()
        {
            try
            {
                if (!(IsPayment || IsBill))
                {
                    MessageBox.Show("Please select either a Bill or Payment Option", "Option Required", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (Amount <= 0)
                {
                    MessageBox.Show("Please enter an amount", "Amount Required", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (BillNo.Trim().Length == 0)
                {
                    MessageBox.Show("Please enter Bill Number", "Bill Number Required", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else if (IsPayment && SelectedPaymentMode == null)
                {
                    MessageBox.Show("Please select Payment Mode", "Payment Mode Required", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    CanBill = false;
                    if (IsBill)
                    {
                        SupplierBillModel billData = new SupplierBillModel
                        {
                            SupplierID = Supplier.ID,
                            ProjectID  = ParentLayout.SelectedProject.ID,
                            BillNo     = BillNo,
                            BillDate   = BillDate,
                            Amount     = Amount,
                            Remarks    = Remarks,
                            Status     = true,
                            CreatedOn  = DateTime.Now,
                            CreatedBy  = ParentLayout.LoggedInUser.Name
                        };

                        HttpResponseMessage result = await apiHelper.PostSupplierBill(ParentLayout.LoggedInUser.Token, billData).ConfigureAwait(false);

                        if (result.IsSuccessStatusCode)
                        {
                            MessageBox.Show($"Bill Added Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                            await GetBills();

                            ClearFields();
                        }
                        else
                        {
                            MessageBox.Show("Error in adding bill", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else if (IsPayment)
                    {
                        SupplierPaymentModel paymentData = new SupplierPaymentModel
                        {
                            SupplierBillID = SelectedBill.ID,
                            PaidOn         = BillDate,
                            Amount         = Amount,
                            PaymentModeID  = SelectedPaymentMode.ID,
                            Remarks        = Remarks,
                            Status         = true,
                            CreatedOn      = DateTime.Now,
                            CreatedBy      = ParentLayout.LoggedInUser.Name
                        };

                        HttpResponseMessage result = await paymentApiHelper.PostSupplierPayment(ParentLayout.LoggedInUser.Token, paymentData).ConfigureAwait(false);

                        if (result.IsSuccessStatusCode)
                        {
                            MessageBox.Show($"Payment Added Successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
                            await GetBills();

                            ClearFields();
                        }
                        else
                        {
                            MessageBox.Show("Error in adding bill", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    CanBill = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                CanBill = true;
            }
        }
示例#5
0
        public StockUpStep()
        {
            InitializeComponent();
            Task.Run(async() => {
                var cameraStatus  = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);
                var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage);

                if (cameraStatus != PermissionStatus.Granted || storageStatus != PermissionStatus.Granted)
                {
                    var results   = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });
                    cameraStatus  = results[Permission.Camera];
                    storageStatus = results[Permission.Storage];
                }
            });
            stockUpBillModel = new StockUpBillModel();
            stepstate        = false;
            BillNo.SetBinding(Label.TextProperty, new Binding("FBillNo")
            {
                Source = stockUpBillModel
            });
            Name.SetBinding(Label.TextProperty, new Binding("F_XAY_Custom")
            {
                Source = stockUpBillModel
            });
            Phone.SetBinding(Label.TextProperty, new Binding("F_XAY_Phone")
            {
                Source = stockUpBillModel
            });
            listview.ItemTapped += async delegate
            {
                ScanPage scanPage = new ScanPage(2);
                scanPage.Title          = "扫描二维码";
                scanPage.BindingContext = stockUpBillModel;
                await Navigation.PushAsync(scanPage);
            };
            scanBarAnimation.OnClick += async delegate
            {
                ScanPage scanPage = new ScanPage(1);
                scanPage.Title          = "扫描备货单条码";
                scanPage.BindingContext = stockUpBillModel;
                await Navigation.PushAsync(scanPage);

                //scanstacklayout.IsVisible = false;
                //resultstacklayout.IsVisible = true;
            };
            scanQrAnimation.OnClick += async delegate
            {
                if (string.IsNullOrWhiteSpace(stockUpBillModel.FBillNo))
                {
                    scanQrAnimation.IsEnabled = false;
                    await scanQrAnimation.TranslateTo(20, 0, 50);

                    await scanQrAnimation.TranslateTo(0, 0, 50);

                    await scanQrAnimation.TranslateTo(-20, 0, 50);

                    await scanQrAnimation.TranslateTo(0, 0, 50);

                    await scanQrAnimation.TranslateTo(20, 0, 50);

                    await scanQrAnimation.TranslateTo(0, 0, 50);

                    Device.BeginInvokeOnMainThread(() => { scanQrAnimation.IsEnabled = true; });
                    DependencyService.Get <IToast>().LongAlert("请先扫描备货单条码");
                }
                else
                {
                    ScanPage scanPage = new ScanPage(2);
                    scanPage.Title          = "扫描二维码";
                    scanPage.BindingContext = stockUpBillModel;
                    await Navigation.PushAsync(scanPage);
                }
            };
            scanbtn.Clicked += async delegate
            {
                ScanPage scanPage;

                if (string.IsNullOrWhiteSpace(stockUpBillModel.FBillNo))
                {
                    scanPage       = new ScanPage(1);
                    scanPage.Title = "扫描备货单条码";
                }
                else
                {
                    scanPage       = new ScanPage(2);
                    scanPage.Title = "扫描二维码";
                }
                scanPage.BindingContext = stockUpBillModel;
                await Navigation.PushAsync(scanPage);
            };
            picbtn.Clicked += async delegate {
                StockUpPhoto picpage = new StockUpPhoto();
                picpage.BindingContext = stockUpBillModel.FBillNo;
                await Navigation.PushAsync(picpage);
            };
        }
示例#6
0
        private void ExecuteSave(object obj)
        {
            string  strSql;
            string  CurMiti;
            string  BillNo;
            decimal Taxable, VAT, _Amount, Discount, NonTaxable;

            if (string.IsNullOrEmpty(Particulars))
            {
                MessageBox.Show("Please select particulars first.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            if (Amount <= 0)
            {
                MessageBox.Show("Amount must be greater than Zero", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            if (MessageBox.Show("You are about to save current transaction. Do you really want to proceed ?", "Save Transaction", MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }
            string Message = string.Empty;

            try
            {
                CurMiti = nepDate.CBSDate(CurDate);
                using (SqlConnection conn = new SqlConnection(GlobalClass.TConnectionString))
                {
                    conn.Open();
                    using (SqlTransaction tran = conn.BeginTransaction())
                    {
                        BillNo     = InvoicePrefix + GlobalClass.GetInvoiceNo(InvoicePrefix, tran);
                        _Amount    = Amount / (1 + (GlobalClass.VAT / 100));
                        Discount   = 0;
                        NonTaxable = 0;
                        Taxable    = _Amount - (NonTaxable + Discount);
                        VAT        = Taxable * GlobalClass.VAT / 100;

                        string strSQL = string.Format
                                        (
                            @"INSERT INTO ParkingSales (BillNo, TDate, TMiti, TTime, BILLTO, BILLTOADD, BILLTOPAN, Description, Amount, Discount, NonTaxable, Taxable, VAT, GrossAmount, PID, UID, SESSION_ID, FYID, TaxInvoice, Remarks) 
                                    VALUES (@BillNo, @TDATE, @TMITI, @TTIME, @BILLTO, @BILLTOADD, @BILLTOPAN, 'Parking Charge', @Amount, @Discount, @NonTaxable, @Taxable, @VAT, @GrossAmount, @PID, @UID, @SESSION_ID, @FYID, @TaxInvoice, @Remarks)"
                                        );
                        conn.Execute(strSQL, new
                        {
                            BillNo      = BillNo,
                            TDATE       = CurDate.Date,
                            TMITI       = CurMiti,
                            TTIME       = CurTime,
                            BILLTO      = BillTo,
                            BILLTOADD   = BillToAdd,
                            BILLTOPAN   = BillToPan,
                            Amount      = _Amount,
                            Discount    = Discount,
                            NonTaxable  = NonTaxable,
                            Taxable     = Taxable,
                            VAT         = VAT,
                            GrossAmount = Amount,
                            PID         = 0,
                            UID         = GlobalClass.User.UID,
                            SESSION_ID  = GlobalClass.Session,
                            FYID        = GlobalClass.FYID,
                            TaxInvoice  = TaxInvoice,
                            Remarks     = Remarks
                        }, transaction: tran);
                        conn.Execute("UPDATE tblSequence SET CurNo = CurNo + 1 WHERE VNAME = @VNAME AND FYID = @FYID", new { VNAME = InvoicePrefix, FYID = GlobalClass.FYID }, transaction: tran);
                        tran.Commit();
                        ExecuteUndo(null);
                    }
                    RawPrinterHelper.SendStringToPrinter(GlobalClass.PrinterName, ((char)27).ToString() + ((char)112).ToString() + ((char)0).ToString() + ((char)64).ToString() + ((char)240).ToString(), "Receipt");
                    PrintBill(BillNo.ToString(), conn);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#7
0
        private void ExecuteShowReport()
        {
            Result       = null;
            SearchStatus = String.Empty;
            if (SelectedExpenseColumns.Count == 0)
            {
                MessageBox.Show("No Columns selected");
                return;
            }
            if (DateTime.Compare(StartDate.Date, EndDate.Date) > 0)
            {
                MessageBox.Show("Start Date should be before End Date");
                return;
            }
            Result = new FlowDocument();
            if (!WithDetails)
            {
                List <MahalluManager.Model.Expense> input = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    if (DateTime.Compare(StartDate, EndDate) == 0)
                    {
                        input = unitOfWork.Expenses.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate.Date) == 0).ToList();
                    }
                    else
                    {
                        input = unitOfWork.Expenses.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate) >= 0 && DateTime.Compare(x.CreatedOn, EndDate) <= 0).ToList();
                    }
                    if (Category != null)
                    {
                        input = input.Where(x => x.CategoryName == Category.Name).ToList();;
                    }
                }
                if (ValidateReportParameters())
                {
                    BuildReport(input);
                }
            }
            else
            {
                List <MahalluManager.Model.Expense> input = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    input = unitOfWork.Expenses.GetAll().ToList();
                    if (Category != null)
                    {
                        input = input.Where(x => x.CategoryName == Category.Name).ToList();;
                    }
                }

                List <ExpenseDetails> inputDetails = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    if (DateTime.Compare(StartDate, EndDate) == 0)
                    {
                        inputDetails = unitOfWork.ExpenseDetails.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate.Date) == 0).ToList();
                    }
                    else
                    {
                        inputDetails = unitOfWork.ExpenseDetails.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate) >= 0 && DateTime.Compare(x.CreatedOn, EndDate) <= 0).ToList();
                    }
                }
                String[] temp = null;
                if (!String.IsNullOrEmpty(Name))
                {
                    if (Name.Contains(";"))
                    {
                        temp = Name.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = Name;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.Name, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(BillNo))
                {
                    temp = null;
                    if (BillNo.Contains(";"))
                    {
                        temp = BillNo.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = BillNo;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.BillNo, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(CareOf))
                {
                    temp = null;
                    if (CareOf.Contains(";"))
                    {
                        temp = CareOf.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = CareOf;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.CareOf, new ContainsComparer())).ToList();
                    }
                }
                if (ValidateReportParameters())
                {
                    BuildReport(input, inputDetails);
                }
            }
        }