コード例 #1
0
ファイル: Program.cs プロジェクト: hthai0598/CakesManager
        public static void GetInvoiceDetails()
        {
            decimal khach;
            decimal tralai;

            System.Console.Clear();
            string row1 = "=====================================================================";
            string row2 = "---------------------------------------------------------------------";

            System.Console.WriteLine(row1);
            System.Console.WriteLine(row2);
            staffbl = new StaffBL();
            staff   = staffbl.Login(u, pass);
            System.Console.WriteLine("");

            System.Console.WriteLine("                      CỬA HÀNG BÁNH NGỌT ABC");
            System.Console.WriteLine("                                   12 Phố Huế ---- Hai Bà Trưng ---- Hà Nội");
            System.Console.WriteLine("                      HÓA ĐƠN THANH TOÁN");
            System.Console.WriteLine("Nhân Viên :       " + staff.StaffID + " Ca Làm Việc : " + staff.calamviec);
            System.Console.WriteLine("Mã Sản Phẩm  ||Tên Sản Phẩm     || Số Lượng       ||  Khuyến Mãi    ||  Đơn Giá     ||Thành Tiền");
            var invoicedetails = invoicebl.GetInvoiceDetails(invoice.invoiceID);

            System.Console.WriteLine("Mã Hóa Đơn: " + invoicedetails.invoiceID);
            System.Console.WriteLine("Ngày:  " + invoicedetails.invoiceDate);
            a = 0;
            foreach (var item in invoicedetails.ItemList)
            {
                System.Console.WriteLine("{0,-15} {1,-15} {2,-15} {3,-15} {4,-15} {5,-15}", item.itemID, item.itemName, item.amount, item.Promotion, item.unitPrice + ".000 VNĐ", item.total + ".000 VNĐ");
                a = a + item.total;
            }
            System.Console.WriteLine(row2);
            System.Console.WriteLine("Thanh Toán: " + a + ".000 VNĐ");
            System.Console.Write("Tiền Nhận: ");
            do
            {
                khach  = Convert.ToInt32(System.Console.ReadLine());
                tralai = khach - a;

                if (khach < a)
                {
                    System.Console.WriteLine("Số tiền Không Đủ Để Thanh Toán - Hãy Nhập Lại");
                }
                else
                {
                    System.Console.WriteLine("Tiền Dư : " + tralai + ".000 VNĐ");
                }
            } while (khach < a);
            System.Console.WriteLine();
            System.Console.WriteLine("                      Cảm Ơn Và Hẹn Gặp Lại!!!!");
            System.Console.WriteLine("Nhấn Để Về MENU Nhân Viên");
            System.Console.ReadLine();
            MenuStaff();
        }
コード例 #2
0
        public ServerResponse GetInvoiceDetail(string invoiceID)
        {
            var res = new ServerResponse();

            using (InvoiceBL InvoiceBL = new InvoiceBL())
            {
                try
                {
                    res.Data = InvoiceBL.GetInvoiceDetails(invoiceID);
                }
                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
コード例 #3
0
ファイル: InvoiceForm.cs プロジェクト: kirubams/ManiMotors
        private void LoadDefaultValues()
        {
            InvoiceBL iBL = new InvoiceBL();

            _invoiceId = iBL.NextInvoiceID();
            var invDTO = iBL.GetInvoiceDetails(_vehicleBookingId);

            //Customer
            if (invDTO.Customer != null)
            {
                lblCustomerName.Text = invDTO.Customer.Name;
            }
            //VehicleInventory
            if (invDTO.VehicleInventory != null)
            {
                var vInvDTO = invDTO.VehicleInventory;
                lblEngineNo.Text         = vInvDTO.EngineNo;
                lblChasisNo.Text         = vInvDTO.ChasisNo;
                lblVehicleName.Text      = vInvDTO.VehicleModelName;
                lblEXshowroomprice.Text  = vInvDTO.ExShowRoomPrice.ToString();
                lblLTRT.Text             = vInvDTO.LT_RT_OtherExp.ToString();
                lblInsurance.Text        = vInvDTO.InsurancePrice.ToString();
                lblTotalOnRoadPrice.Text = vInvDTO.OnRoadPrice.ToString();
                lblWarranty.Text         = vInvDTO.WarrantyPrice.ToString();
                var warrantymargin555 = ConfigurationManager.AppSettings["WarrantyMargin555"].ToString();
                var warrantymargin777 = ConfigurationManager.AppSettings["WarrantyMargin777"].ToString();
                invMargin.Text = vInvDTO.MarginPrice.ToString();
                //Add IA Margin
                var IAMgnDTO = new InvoiceMarginDTO()
                {
                    InvoiceID        = _invoiceId,
                    InvoiceType      = "SALES",
                    VehicleBookingID = _vehicleBookingId,
                    MarginTypeID     = 1,//For IA Margin
                    MarginID         = vInvDTO.VehicleInventoryID,
                    ManualAmount     = 0,
                    MarginAmount     = vInvDTO.MarginPrice,
                    ActualAmount     = vInvDTO.ExShowRoomPrice,
                    IsReceived       = false,
                    ReceivedDate     = null,
                    IsCash           = false,
                    ChequeBankTranNo = "",
                    Remarks          = "",
                    CreatedDate      = DateTime.Now,
                    CreatedBy        = GlobalSetup.Userid,
                    ModifiedBy       = null,
                    ModifiedDate     = null
                    , InvoiceDate    = Convert.ToDateTime(dtInvoice.Text)
                };
                lst.Add(IAMgnDTO);

                if (vInvDTO.WarrantyPrice == 555)
                {
                    lblWarrantyMargin.Text = warrantymargin555;
                    int m555 = Convert.ToInt32(warrantymargin555);
                    //Add Warranty Margin
                    var marginW555 = new InvoiceMarginDTO()
                    {
                        InvoiceID        = _invoiceId,
                        InvoiceType      = "SALES",
                        VehicleBookingID = _vehicleBookingId,
                        MarginTypeID     = 3,//For warranty
                        MarginID         = vInvDTO.VehicleInventoryID,
                        ManualAmount     = 0,
                        MarginAmount     = m555,
                        ActualAmount     = vInvDTO.WarrantyPrice,
                        IsReceived       = false,
                        ReceivedDate     = null,
                        IsCash           = false,
                        ChequeBankTranNo = "",
                        Remarks          = "",
                        CreatedDate      = DateTime.Now,
                        CreatedBy        = GlobalSetup.Userid,
                        ModifiedBy       = null,
                        ModifiedDate     = null
                        ,
                        InvoiceDate = Convert.ToDateTime(dtInvoice.Text)
                    };
                    lst.Add(marginW555);
                }
                else if (vInvDTO.WarrantyPrice == 777)
                {
                    lblWarrantyMargin.Text = warrantymargin777;
                    int m777 = Convert.ToInt32(warrantymargin777);
                    //Add Warranty Margin
                    var marginW555 = new InvoiceMarginDTO()
                    {
                        InvoiceID        = _invoiceId,
                        InvoiceType      = "SALES",
                        VehicleBookingID = _vehicleBookingId,
                        MarginID         = vInvDTO.VehicleInventoryID,
                        MarginTypeID     = 3,//For warranty
                        ManualAmount     = 0,
                        MarginAmount     = m777,
                        ActualAmount     = vInvDTO.WarrantyPrice,
                        IsReceived       = false,
                        ReceivedDate     = null,
                        IsCash           = false,
                        ChequeBankTranNo = "",
                        Remarks          = "",
                        CreatedDate      = DateTime.Now,
                        CreatedBy        = GlobalSetup.Userid,
                        ModifiedBy       = null,
                        ModifiedDate     = null,
                        InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                    };
                    lst.Add(marginW555);
                }
                else
                {
                    lblWarrantyMargin.Text = "0";
                }

                totalDebitVal.Text = (vInvDTO.OnRoadPrice).ToString();
            }

            //SparePartsInventory
            if (invDTO.lstSparePartsInventory != null && invDTO.lstSparePartsInventory.Count > 0)
            {
                int i = 1;
                foreach (var spInventory in invDTO.lstSparePartsInventory)
                {
                    if (i == 1)
                    {
                        lblFitting1.Visible      = true;
                        lblFitting1Value.Visible = true;
                        lblFitting1.Text         = spInventory.SparePartsModelName.ToUpper();
                        lblFitting1Value.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin1.Visible         = true;
                        fMargin1.Text            = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 2)
                    {
                        lblFitting2.Visible    = true;
                        lblFitting2Val.Visible = true;
                        lblFitting2.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting2Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin2.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin2.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 3)
                    {
                        lblFitting3.Visible    = true;
                        lblFitting3Val.Visible = true;
                        lblFitting3.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting3Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin3.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin3.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 4)
                    {
                        lblFitting4.Visible    = true;
                        lblFitting4Val.Visible = true;
                        lblFitting4.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting4Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin4.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin4.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 5)
                    {
                        lblFitting5.Visible    = true;
                        lblFitting5Val.Visible = true;
                        lblFitting5.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting5Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin5.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin5.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 6)
                    {
                        lblFitting6.Visible    = true;
                        lblFitting6Val.Visible = true;
                        lblFitting6.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting6Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin6.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin6.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 7)
                    {
                        lblFitting7.Visible    = true;
                        lblFitting7Val.Visible = true;
                        lblFitting7.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting7Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin7.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin7.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 8)
                    {
                        lblFitting8.Visible    = true;
                        lblFitting8Val.Visible = true;
                        lblFitting8.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting8Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin8.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin8.Visible   = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 9)
                    {
                        lblFitting9.Visible    = true;
                        lblFitting9Val.Visible = true;
                        lblFitting9.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting9Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin9.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin9.Visible   = true;
                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }
                    else if (i == 10)
                    {
                        lblFitting10.Visible    = true;
                        lblFitting10Val.Visible = true;
                        lblFitting10.Text       = spInventory.SparePartsModelName.ToUpper();
                        lblFitting10Val.Text    = spInventory.ShowRoomPrice.ToString();
                        fMargin10.Text          = spInventory.MarginPrice.ToString();
                        var totalPrice = Convert.ToInt32(totalDebitVal.Text);
                        totalDebitVal.Text = (totalPrice + spInventory.ShowRoomPrice).ToString();
                        fMargin10.Visible  = true;

                        //Add SP Margin
                        var sp = new InvoiceMarginDTO()
                        {
                            InvoiceID        = _invoiceId,
                            InvoiceType      = "SALES",
                            VehicleBookingID = _vehicleBookingId,
                            MarginTypeID     = 4,//For Extra Fitting
                            ManualAmount     = 0,
                            MarginID         = spInventory.SparePartsInventoryID,
                            MarginAmount     = spInventory.MarginPrice,
                            ActualAmount     = spInventory.ShowRoomPrice,
                            IsReceived       = false,
                            ReceivedDate     = null,
                            IsCash           = false,
                            ChequeBankTranNo = "",
                            Remarks          = "",
                            CreatedDate      = DateTime.Now,
                            CreatedBy        = GlobalSetup.Userid,
                            ModifiedBy       = null,
                            ModifiedDate     = null,
                            InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                        };
                        lst.Add(sp);
                    }

                    i++;
                }
            }
            //Customer Credit
            if (invDTO.VclBooking != null)
            {
                var vBk = invDTO.VclBooking;
                lblAdvanceCash.Text = vBk.AdvanceAmount.ToString();
                lblFinance.Text     = "Finance By -- " + vBk.FinancierName;
                totalCreditVal.Text = vBk.AdvanceAmount.ToString();
            }

            //Finance Allotment
            if (invDTO.FinanceAllotment != null)
            {
                var fAlt = invDTO.FinanceAllotment;
                lblFinanceVal.Text = fAlt.FinanceAmount.ToString();
                var totalcreditPrice = Convert.ToInt32(totalCreditVal.Text);
                totalCreditVal.Text = (totalcreditPrice + fAlt.FinanceAmount).ToString();
                if (invDTO.VclBooking.FinanceDealer)
                {
                    txtFinanceMargin.Visible = true;
                    //Add Finance margin
                    var sp = new InvoiceMarginDTO()
                    {
                        InvoiceID        = _invoiceId,
                        InvoiceType      = "SALES",
                        VehicleBookingID = _vehicleBookingId,
                        MarginTypeID     = 2,//For Finance Margin
                        ManualAmount     = 0,
                        MarginID         = invDTO.VclBooking.FinancierInfoId ?? 0,
                        MarginAmount     = 0,  //Margin Amount wil be updated
                        ActualAmount     = invDTO.FinanceAllotment.FinanceAmount ?? 0,
                        IsReceived       = false,
                        ReceivedDate     = null,
                        IsCash           = false,
                        ChequeBankTranNo = "",
                        Remarks          = "",
                        CreatedDate      = DateTime.Now,
                        CreatedBy        = GlobalSetup.Userid,
                        ModifiedBy       = null,
                        ModifiedDate     = null,
                        InvoiceDate      = Convert.ToDateTime(dtInvoice.Text)
                    };
                    lst.Add(sp);
                }
            }

            if (txtDiscount.Text != "")
            {
                var totalcreditPrice = Convert.ToInt32(totalCreditVal.Text);
                var discountAmt      = Convert.ToInt32(txtDiscount.Text);
                totalCreditVal.Text = (totalcreditPrice + discountAmt).ToString();
            }
            //}
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: hthai0598/CakesManager
        public static void ThongKeStaff()
        {
            System.Console.Clear();
            System.Console.WriteLine("Thống Kê Hóa Đơn Theo Mã Nhân Viên");
            string row2 = "------------------------------------------";

            System.Console.WriteLine(row2);
            decimal doanhthu = 0;

            staffbl   = new StaffBL();
            invoicebl = new InvoiceBL();
            invoice   = new Invoice();
            item      = new Item();
            staff     = staffbl.Login(u, pass);
            var tk = invoicebl.GetInvoiceByID(u);

            if (tk.Count != 0)
            {
                System.Console.WriteLine("Mã Nhân Viên : " + u);
                System.Console.WriteLine(row2);
                foreach (var liss in tk)
                {
                    System.Console.WriteLine("Mã Hóa Đơn :  " + liss.invoiceID);
                    System.Console.WriteLine("Ngày Tạo  : " + liss.invoiceDate);
                    System.Console.WriteLine(row2);
                }
                char c;
                while (true)
                {
                    System.Console.WriteLine("Bạn Có Muốn Xem Chi Tiết Từng Hóa Đơn Không ? Y/N");
                    c = Convert.ToChar(System.Console.ReadLine());
                    if (c == 'y')
                    {
                        System.Console.Clear();
                        int id;
                        System.Console.WriteLine("Nhập Vào Mã Hóa Đơn Bạn Muốn Xem ");
                        id = Convert.ToInt16(System.Console.ReadLine());
                        for (int i = 0; i < tk.Count; i++)
                        {
                            System.Console.Clear();
                            if (id == tk[i].invoiceID)
                            {
                                var orderdetail = invoicebl.GetInvoiceDetails(id);
                                System.Console.Clear();
                                System.Console.WriteLine(row2);
                                System.Console.WriteLine("Mã Sản Phẩm  ||Tên Sản Phẩm     || Số Lượng       ||  Khuyến Mãi    ||  Đơn Giá     ||Thành Tiền");
                                a = 0;
                                foreach (var item in orderdetail.ItemList)
                                {
                                    System.Console.WriteLine("{0,-15} {1,-15} {2,-15} {3,-15} {4,-15} {5,-15}", item.itemID, item.itemName, item.amount, item.Promotion, item.unitPrice + ".000 VNĐ", item.total + ".000 VNĐ");
                                    a = a + item.total;
                                }
                                System.Console.WriteLine("Doanh Thu Hóa Đơn " + id + " Là : " + a + ".000 VNĐ");
                                doanhthu = doanhthu + a;
                                System.Console.WriteLine("Nhấn Phím Bất Kì Để Trở Về Menu Nhân Viên....");
                                System.Console.ReadKey();
                                MenuStaff();
                            }
                            else
                            {
                                System.Console.WriteLine("Không tìm thấy hóa đơn");
                                System.Console.ReadLine();
                                ThongKeStaff();
                            }
                        }
                    }
                    else
                    {
                        MenuStaff();
                    }
                }
            }
            else
            {
                System.Console.WriteLine("Chưa Có Hóa Đơn Cho Nhân Viên Này");
                System.Console.WriteLine("Nhấn Phím Bất Kì Để Về Menu Nhân Viên");
                System.Console.ReadLine();
                MenuStaff();
            }
        }
コード例 #5
0
        public void TestGetInvoiceDeTails()
        {
            int id = 2;

            Assert.NotNull(inn.GetInvoiceDetails(id));
        }