示例#1
0
 public PopupPaymentAdd(MainWindow main)
 {
     InitializeComponent();
     bus                 = new BUS_Payment();
     mainWindow          = main;
     tbEmployeeName.Text = main.GetCurrentEmpName();
 }
 public PaymentList()
 {
     InitializeComponent();
     Loaded += LoadData;
     dgPayment.LoadingRow += new EventHandler <DataGridRowEventArgs>(datagrid_LoadingRow);
     bus            = new BUS_Payment();
     currentNumpage = 1;
 }
        private void cmd_tax_Click(object sender, EventArgs e)
        {
            Bus_Cus.CreateFolder(dgv_Data.Rows[index].Cells[0].Value.ToString().Trim());
            Bus_Letter.Kill_process();

            DTO_TaxInvoice _tax       = new DTO_TaxInvoice();
            BUS_TaxInvoce  _bus_tax   = new BUS_TaxInvoce();
            BUS_Payment    _bus_pay   = new BUS_Payment();
            DataTable      tb_payment = new DataTable();

            _tax.Matter_ID = dgv_Data.Rows[index].Cells[0].Value.ToString().Trim();

            DataTable tb_tax = new DataTable();

            tb_tax = _bus_tax.Load(_tax.Matter_ID);
            if (tb_tax.Rows.Count > 0)
            {
                _tax.Tax_No = tb_tax.Rows[0][0].ToString().Trim();
            }
            else
            {
                _tax.Tax_No = _bus_tax.CreateID();
            }


            _bus_tax.Insert(_tax);

            BUS_TimeAndFees _bus_time = new BUS_TimeAndFees();
            DataTable       tb_Sum;

            tb_payment = _bus_pay.Load(_tax.Matter_ID);

            string d = dgv_Data.Rows[index].Cells[17].Value.ToString().Trim();

            if (d == "True")
            {
                tb_Sum = _bus_time.LoadFixedPrice(_tax.Matter_ID);
            }
            else
            {
                tb_Sum = _bus_time.LoadHoursPrice(_tax.Matter_ID);
            }
            string Des = "";

            for (int i = 0; i < tb_Sum.Rows.Count; i++)
            {
                Des += tb_Sum.Rows[i][2].ToString().Trim() + "\t" + tb_Sum.Rows[i][3].ToString().Trim() + "\n";
            }


            Bus_Letter.Fill_TaxInvoice("" + dgv_Data.Rows[index].Cells[5].Value.ToString().Trim() + " " + dgv_Data.Rows[index].Cells[6].Value.ToString().Trim(), dgv_Data.Rows[index].Cells[0].Value.ToString().Trim(), _tax.Tax_No, txt_address1.Text.Trim() + " " + txt_address2.Text.Trim(), cbx_suburb.Text.Trim() + " " + txt_State.Text.Trim() + " " + txt_Post_Code.Text.Trim(), cbx_Salutation.Text.Trim(), Des, tb_payment.Rows[0][2].ToString().Trim(), tb_payment.Rows[0][3].ToString().Trim(), tb_payment.Rows[0][4].ToString().Trim(), tb_payment.Rows[0][5].ToString().Trim(), dgv_Data.Rows[index].Cells[6].Value.ToString().Trim(), fileLocation);
        }
        public PopupPaymentDetail(DTO_Payment dto)
        {
            InitializeComponent();
            bus = new BUS_Payment();
            DataTable tb = bus.findPaymentbyID(dto.PaymentID);

            foreach (DataRow row in tb.Rows)
            {
                tbAmount.Text       = row["TotalAmount"].ToString();
                tbTime.Text         = row["Time"].ToString();
                tbPaymentID.Text    = row["PaymentID"].ToString();
                tbEmployeeName.Text = row["EmployeeName"].ToString();
                tbDescription.Text  = row["Description"].ToString();
            }
        }
        private void btSave_Click(object sender, RoutedEventArgs e)
        {
            switch (this.type)
            {
            case 1:     /// Delete Account
                BUS_ReceiptDetail busReceiptDetail = new BUS_ReceiptDetail();
                bool result1 = busReceiptDetail.DeleteDetailByID(deleteid);

                if (result1)
                {
                    BUS_Receipt busReceipt = new BUS_Receipt();
                    if (busReceipt.DeleteReceiptByID(deleteid))
                    {
                        MessageBox.Show($"Đã xóa hóa đơn {deleteid}.");
                        Window.GetWindow(this).Close();
                    }
                    else
                    {
                        MessageBox.Show($"Đã xảy ra lỗi trong quá trình xóa hóa đơn!");
                    }
                }
                else
                {
                    MessageBox.Show($"Đã xảy ra lỗi trong quá trình xóa chi tiết hóa đơn.");
                }
                break;

            case 2:
                BUS_Payment bus = new BUS_Payment();

                if (bus.deletePayment(deleteid) > 0)
                {
                    MessageBox.Show($"Đã xóa phiếu chi {deleteid}.");
                }
                else
                {
                    MessageBox.Show($"Đã xảy ra lỗi trong quá trình xóa phiếu chi!");
                }
                Window.GetWindow(this).Close();
                break;
            }
        }
        private void LoadGeneralChartYear()
        {
            GeneralChart       = new SeriesCollection();
            LabelGeneralCharts = new List <string>();
            ChartValues <int> Income  = new ChartValues <int>();
            ChartValues <int> Outcome = new ChartValues <int>();
            ChartValues <int> Profit  = new ChartValues <int>();

            for (int i = 0; i < months; i++)
            {
                LabelGeneralCharts.Add("Tháng " + (i + 1));
                Income.Add(0);
                Outcome.Add(0);
                Profit.Add(0);
            }

            BUS_Receipt busRec  = new BUS_Receipt();
            DataTable   RecData = busRec.GetTotalIncomeByYear(dpMonthYear.SelectedDate.GetValueOrDefault().Year);

            foreach (DataRow row in RecData.Rows)
            {
                Income[Int32.Parse(row["Month"].ToString()) - 1]  = Int32.Parse(row["TotalAfterDis"].ToString());
                Profit[Int32.Parse(row["Month"].ToString()) - 1] += Int32.Parse(row["TotalAfterDis"].ToString());
            }

            BUS_InventoryImport busInvImp  = new BUS_InventoryImport();
            DataTable           InvImpData = busInvImp.GetTotalAmountByYear(dpMonthYear.SelectedDate.GetValueOrDefault().Year);

            foreach (DataRow row in InvImpData.Rows)
            {
                Outcome[Int32.Parse(row["Month"].ToString()) - 1] = Int32.Parse(row["TotalAmount"].ToString());
                Profit[Int32.Parse(row["Month"].ToString()) - 1] -= Int32.Parse(row["TotalAmount"].ToString());
            }

            BUS_Payment busPay  = new BUS_Payment();
            DataTable   PayData = busPay.GetTotalAmountByYear(dpMonthYear.SelectedDate.GetValueOrDefault().Year);

            foreach (DataRow row in PayData.Rows)
            {
                Outcome[Int32.Parse(row["Month"].ToString()) - 1] += Int32.Parse(row["Total"].ToString());
                Profit[Int32.Parse(row["Month"].ToString()) - 1]  -= Int32.Parse(row["Total"].ToString());
            }

            GeneralChart.Add(new ColumnSeries
            {
                Title          = "Doanh thu ",
                Values         = Income,
                MaxColumnWidth = 16
            });
            GeneralChart.Add(new ColumnSeries
            {
                Title          = "Chi phí",
                Values         = Outcome,
                MaxColumnWidth = 16
            });
            GeneralChart.Add(new ColumnSeries
            {
                Title          = "Lợi nhuận",
                Values         = Profit,
                MaxColumnWidth = 16
            });

            //FormatterGeneralCharts = value => value.ToString("N");
            generalChart.AxisX.Clear();
            generalChart.AxisX.Add(new Axis
            {
                Title          = "",
                LabelFormatter = value => "Tháng " + (value + 1).ToString(),
                FontSize       = 15,
                Foreground     = (SolidColorBrush) new BrushConverter().ConvertFromString("#6B6158")
            });
            generalChart.Series    = GeneralChart;
            generalChart.Width     = LabelGeneralCharts.Count * 80;
            generalChartTitle.Text = $"Biểu đồ thống kê tổng quát năm {dpMonthYear.SelectedDate.GetValueOrDefault().Year}";
        }
示例#7
0
 public PopupPaymentAdd()
 {
     InitializeComponent();
     bus = new BUS_Payment();
 }