private void simpleButton1_Click(object sender, EventArgs e) { // save to database PhieuChi newPhieuChi = new PhieuChi(); newPhieuChi.MaKH = comboBox1.SelectedIndex - 1; newPhieuChi.NgayPS = dtCreateDate.Value; newPhieuChi.SoPC = db.PhieuChis.Count() + 1; newPhieuChi.SoTien = Convert.ToDecimal(txtMoney.Text); db.PhieuChis.Add(newPhieuChi); //db.SaveChanges(); // open report form FormToView frm = new FormToView(); frm.Address = txtDiaChi.Text; frm.SoTT = txtMoney.Text; frm.HoaDonID = newPhieuChi.SoPC; frm.CustomerName = txtName.Text; rp_PhieuChi newRP = new rp_PhieuChi(frm, rtDescription.Text); ReportPrintTool tool = new ReportPrintTool(newRP); tool.ShowPreviewDialog(); tool.Report.CreateDocument(); }
private void simpleButton1_Click(object sender, EventArgs e) { // save to database PhieuThu pt = new PhieuThu(); pt.MaKH = Convert.ToInt32(comboBox1.SelectedItem); pt.NgayPS = DateTime.Now; pt.SoPT = db.PhieuThus.Count() + 1; pt.SoTien = Convert.ToDecimal(txtMoney.Text); db.PhieuThus.Add(pt); // open report dialog FormToView form = new FormToView(); form.Address = txtAddress.Text; form.HoaDonID = pt.SoPT; form.NgayPS = pt.NgayPS; form.CustomerName = txtName.Text; form.PostalCode = db.DMKHs.FirstOrDefault(p => p.MaKH == pt.MaKH).MaST; form.SoTT = pt.SoTien.ToString(); rp_PhieuThu newPT = new rp_PhieuThu(form, rtDescription.Text); ReportPrintTool rp = new ReportPrintTool(newPT); rp.ShowPreviewDialog(); rp.Report.CreateDocument(); }
private void OpenRpBanHang() { if (comboboxNCC.SelectedText == "") { MessageBox.Show("Chọn khách hàng"); return; } FormToView fView = new FormToView(); int so = comboboxNCC.SelectedIndex + 1; fView.CustomerName = comboboxNCC.SelectedText; fView.Address = db.DMKHs.FirstOrDefault(p => p.MaKH == so).DiaChi ?? ""; fView.NgayPS = DateTime.Now; fView.PostalCode = db.DMKHs.FirstOrDefault(p => p.MaKH == so).MaST ?? ""; fView.HoaDonID = MaHDBH; fView.SoTT = txtThanhToan.Text; rp_HoaDon _HoaDon = new rp_HoaDon(infoViews, fView); ReportPrintTool reportPrint = new ReportPrintTool(_HoaDon); reportPrint.ShowPreviewDialog(); // Create the report's document. reportPrint.Report.CreateDocument(); }
// hoàn thành giao dịch private void simpleButton3_Click(object sender, EventArgs e) { if (comboboxNCC.SelectedText == "") { return; } int maHDNhap = 0; int makh = comboboxNCC.SelectedIndex + 1; // save to HDNhap // MaKH is Mart ID //HDNhap bufHDNhap = new HDNhap(); //bufHDNhap.MaHDNhap = db.HDNhaps.Select(p => p.MaHDNhap).Count() + 1; //bufHDNhap.MaKH = makh; //bufHDNhap.NgayNhap = dateTimePicker1.Value; //bufHDNhap.SoThanhToan = Convert.ToDecimal(txtThanhToan.Text); //db.HDNhaps.Add(bufHDNhap); //db.SaveChanges(); //// save to HDNhap Chi tiet //maHDNhap = db.HDNhaps.Select(p => p.MaHDNhap).Count(); //int x = gridView.RowCount; //gridView.AddNewRow(); //for(int i = 0; i < x; i++) //{ // HDNhapCT ct = new HDNhapCT(); // ct.MaHDNhap = maHDNhap; // ct.MaHang = Convert.ToInt32(gridView.GetRowCellValue(i, gridView.Columns["MaHang"])); // ct.DonGia = Convert.ToDecimal(gridView.GetRowCellValue(i, gridView.Columns["DonGia"])); // ct.SoLuong = Convert.ToInt32(gridView.GetRowCellValue(i, gridView.Columns["SoLuong"])); // db.HDNhapCTs.Add(ct); // db.SaveChanges(); //} //MessageBox.Show("Đang thực thi ..."); // open report Nhap Hang FormToView fView = new FormToView(); fView.CustomerName = comboboxNCC.Text; fView.HoaDonID = db.HDNhaps.Select(p => p.MaHDNhap).Count() + 1; fView.NgayPS = DateTime.Now; fView.TongTien = txtTongGiaTien.Text; fView.SoTT = txtThanhToan.Text; fView.ThueVAT = txtThueVAT.Text; fView.ConDu = txtSoConNo.Text; rp_NhapHang _HoaDon = new rp_NhapHang(infoViews, fView); ReportPrintTool reportPrint = new ReportPrintTool(_HoaDon); reportPrint.ShowPreviewDialog(); // Create the report's document. reportPrint.Report.CreateDocument(); }
public rp_PhieuChi(FormToView form, string txt) { InitializeComponent(); pDate.Value = DateTime.Now; pName.Value = form.CustomerName; pSo.Value = form.HoaDonID; pMoney.Value = form.SoTT; pDescription.Value = txt; }
public rp_NhapHang(List <InfoView> list, FormToView fmToView) { InitializeComponent(); infoViews = new List <InfoView>(); infoViews = list; fView = fmToView; pCustomerName.Value = fmToView.CustomerName; pHDNhapID.Value = fmToView.HoaDonID; pHDDate.Value = DateTime.Now; pTongTien.Value = fmToView.TongTien; pThueVAT.Value = fmToView.ThueVAT; pThanhToan.Value = fmToView.SoTT; pConDu.Value = fmToView.ConDu; Init(); }
public rp_HoaDon(List <InfoView> list, FormToView formToView) { InitializeComponent(); // init at the same form pCustomerName.Value = formToView.CustomerName; pAddress.Value = formToView.Address; pPostalCode.Value = formToView.PostalCode; pOrderID.Value = formToView.HoaDonID; pOrderDate.Value = DateTime.Now; xrThanhToan.Text = formToView.SoTT; initTable(list); }