Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cbbNhanVien.Text == "" || int.Parse(txtTongTien.Text) < 1)
            {
                /// bắt lỗi
            }
            else
            {
                // bắt lỗi cho cbb

                /// add Phiếu Nhập vào SQL
                SQL_KhoHang.Add_PhieuNhapHang(cbbNhanVien.SelectedValue.ToString(), dpkNgayNhap.Value.ToString("yyyy-MM-dd"), decimal.Parse(txtTongTien.Text), decimal.Parse(txtDaThanhToan.Text));

                /// lấy mã phiếu nhập hàng vừa nhập
                string    Temp_PhieuNhapHang = "";
                DataTable Temp = SQL_KhoHang.Display_PhieuNhapKho();
                Temp_PhieuNhapHang = Temp.Rows[Temp.Rows.Count - 1][0].ToString();

                /// add bảng listview Chi tiết phiếu nhập vào SQL
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    SQL_KhoHang.Add_ChiTietNhapHang(Temp_PhieuNhapHang, listView1.Items[i].SubItems[1].Text, int.Parse(listView1.Items[i].SubItems[3].Text), decimal.Parse(listView1.Items[i].SubItems[5].Text));
                }

                /// add vào bảng nợ nếu  chưa thanh toán
                if (int.Parse(txtTongTien.Text) > int.Parse(txtDaThanhToan.Text))
                {
                    decimal tienno = decimal.Parse(txtTongTien.Text) - decimal.Parse(txtDaThanhToan.Text);
                    SQL_CongNo.Add_PhieuNo(Temp_PhieuNhapHang, tienno, false);
                }
                MessageBox.Show("Thêm Hóa đơn thành công.");
                reset();
            }
        }
Beispiel #2
0
 private void btnThanhToan_Click(object sender, EventArgs e)
 {
     /// add vào  bảng trả nợ
     SQL_CongNo.Add_PhieuTraNo(Temp.Temp_PhieuNoID, DateTime.Now.ToString("yyyy-MM-dd"), decimal.Parse(txtTongTien.Text), "Chủ cửa hàng");
     /// sửa tình trạng phiếu nợ
     SQL_CongNo.Edit_PhieuNo(int.Parse(Temp.Temp_PhieuNoID), true);
     MessageBox.Show("cập nhật trả nợ thành công.");
 }
        void LoadInfor()
        {
            DataTable phieuno = SQL_CongNo.Display_PhieuNo();

            txtSoPhieuNo.Text = phieuno.Rows.Count.ToString();
            int tongtien = 0;

            for (int i = 0; i < phieuno.Rows.Count; i++)
            {
                tongtien = tongtien + int.Parse(phieuno.Rows[i][3].ToString());
            }
            txtTongTien.Text = tongtien.ToString();
        }
 private void cbbNCC_SelectedValueChanged(object sender, EventArgs e)
 {
     //load bang
     if (cbbNCC.Text != "" && isLoadDone)
     {
         DataTable phieuno_NCC = SQL_CongNo.Display_PhieuNo_Find(cbbNCC.SelectedValue.ToString());;
         gridControl1.DataSource = phieuno_NCC;
         fixHeaderName();
         /// load thông tin riêng
         txtSoPhieuNo_NCC.Text = phieuno_NCC.Rows.Count.ToString();
         int tongtien = 0;
         for (int i = 0; i < phieuno_NCC.Rows.Count; i++)
         {
             tongtien = tongtien + int.Parse(phieuno_NCC.Rows[i][3].ToString());
         }
         txtTongTien_NCC.Text = tongtien.ToString();
     }
 }
Beispiel #5
0
        private void gridView1_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            /// load chi tiết phiếu nợ

            /// mã  stt nợ
            Temp.Temp_PhieuNoID = gridView1.GetRowCellValue(e.RowHandle, "STT_No").ToString();
            // lấy mã phiếu nhập
            DataTable bangno = SQL_CongNo.Display_PhieuNo();

            for (int i = 0; i < bangno.Rows.Count; i++)
            {
                if (Temp.Temp_PhieuNoID == bangno.Rows[i][0].ToString())
                {
                    Temp.Temp_PhieuNhapHangID = bangno.Rows[i][1].ToString();
                }
            }
            Form_ChiTietPhieuNo dlg2 = new Form_ChiTietPhieuNo();

            dlg2.ShowDialog();
        }
Beispiel #6
0
        void check_TinhTrangNo()
        {
            DataTable check = SQL_CongNo.Display_PhieuNo();

            for (int i = 0; i < check.Rows.Count; i++)
            {
                if (Temp.Temp_PhieuNoID == check.Rows[i][0].ToString())
                {
                    // MessageBox.Show(check.Rows[i][4].ToString());
                    if (check.Rows[i][4].ToString() == "True")
                    {
                        btnThanhToan.Enabled = false;
                        txtDaThanhToan.Text  = check.Rows[i][3].ToString();
                    }
                    else
                    {
                        btnThanhToan.Enabled = true;
                    }
                }
            }
        }
 void display()
 {
     gridControl1.DataSource = SQL_CongNo.Display_PhieuNo();
     fixHeaderName();
 }