/// <summary> /// fill data to bill /// </summary> /// <param name="objBillDto"></param> /// <param name="data"></param> /// GIAO DỊCH BÁN LẺ public void PrintInvoice_BanLe(BILL_DTO objBillDto, NVGDQUAY_ASYNCCLIENT_DTO _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL) { done = true; try { ReportBill report = new ReportBill(); foreach (Parameter p in report.Parameters) { p.Visible = false; } report.InitDataBillBanLe(_NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL, objBillDto); dcmvContent.DocumentSource = report; report.CreateDocument(); report.Print(); } catch { NotificationLauncher.ShowNotificationError("THÔNG BÁO", "KHÔNG TÌM THẤY MÁY IN", 1, "0x1", "0x8", "normal"); } }
// GIAO DỊCH BÁN LẺ public void InitDataBillBanLeTraLai(GIAODICH_DTO _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL, BILL_DTO objecBillDto) { p_Phone.Value = objecBillDto.PHONE; p_Address.Value = objecBillDto.ADDRESS; p_MaGiaoDich.Value = objecBillDto.MA_GIAODICH; p_InfoThuNgan.Value = objecBillDto.INFOTHUNGAN; p_MaKH.Value = objecBillDto.MAKH; p_Diem.Value = objecBillDto.DIEM; p_ThanhTienChu.Value = objecBillDto.THANHTIENCHU; p_ConLai.Value = objecBillDto.CONLAI; p_TienKhachTra.Value = objecBillDto.TIENKHACHTRA; p_TenCuaHang.Value = objecBillDto.TENCUAHANG; if (_NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS.Count > 0) { List <VATTU_DTO.OBJ_VAT> obj_Vat = new List <VATTU_DTO.OBJ_VAT>(); foreach (var rowData in _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS) { var existVat = obj_Vat.FirstOrDefault(x => x.MATHUE_RA == rowData.MATHUE_RA); if (existVat != null) { existVat.CHUACO_GTGT += rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100)); existVat.CO_GTGT += (rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100))) * (rowData.GIATRI_THUE_RA / 100); } else { VATTU_DTO.OBJ_VAT vat = new VATTU_DTO.OBJ_VAT(); vat.MATHUE_RA = rowData.MATHUE_RA; vat.GIATRI_THUE_RA = rowData.GIATRI_THUE_RA; vat.CHUACO_GTGT = rowData.THANHTIEN / (1 + (rowData.GIATRI_THUE_RA / 100)); vat.CO_GTGT = vat.CHUACO_GTGT * (vat.GIATRI_THUE_RA / 100); obj_Vat.Add(vat); } decimal tempKM = 0; try { tempKM = rowData.TIEN_KHUYENMAI + rowData.TIEN_CHIETKHAU; } catch (Exception) { } if (tempKM != 0) { rowData.THANHTIENFULL = string.Format(@"KM " + FormatCurrency.FormatMoney(tempKM) + " " + FormatCurrency.FormatMoney(rowData.THANHTIEN)); } else { rowData.THANHTIENFULL = FormatCurrency.FormatMoney(rowData.THANHTIEN); } int vattat = 0; int.TryParse(rowData.MATHUE_RA, out vattat); rowData.MAVATTAT = vattat.ToString(); } if (obj_Vat.Count > 0) { decimal TONGCHUAVAT = 0, TONGCOVAT = 0; foreach (VATTU_DTO.OBJ_VAT item in obj_Vat) { int vattat = 0; int.TryParse(item.MATHUE_RA, out vattat); XRTableRow row = new XRTableRow(); row.Cells.Add(new XRTableCell() { Text = vattat.ToString() + " > " + item.GIATRI_THUE_RA.ToString("#0'%'"), TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); row.Cells.Add(new XRTableCell() { Text = item.CHUACO_GTGT.ToString("##,###"), TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); row.Cells.Add(new XRTableCell() { Text = item.CO_GTGT.ToString("##,###"), TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); xtVAT.Rows.Add(row); TONGCHUAVAT += item.CHUACO_GTGT; TONGCOVAT += item.CO_GTGT; } XRTableRow rowData = new XRTableRow(); rowData.Cells.Add(new XRTableCell() { Text = "Tổng : ", TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); rowData.Cells.Add(new XRTableCell() { Text = TONGCHUAVAT.ToString("##,###"), TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); rowData.Cells.Add(new XRTableCell() { Text = TONGCOVAT.ToString("##,###"), TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter, Font = new Font(Font.FontFamily, 6, FontStyle.Regular) }); xtTong.Rows.Add(rowData); } } objectDataSource1.DataSource = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.LST_DETAILS; }
private void THANHTOAN_HOADON_BANLE_TRALAI() { string TONGTIEN_BANGCHU = ConvertSoThanhChu.ChuyenDoiSoThanhChu(_NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL.TTIENCOVAT); try { LUU_DULIEU(_NVGDQUAY_ASYNCCLIENT_DTO_GLOBAL); } catch { MessageBox.Show("CẢNH BÁO ! XẢY RA LỖI KHI LƯU HÓA ĐƠN NÀY, HÃY LƯU LẠI HÓA ĐƠN ĐỂ KIỂM TRA ! XIN CẢM ƠN "); } try { string MA_TEN_KHACHHANG = ""; string msg = Config.CheckConnectToServer(out bool result); if (msg.Length > 0) { MessageBox.Show(msg); return; } if (result) { MA_TEN_KHACHHANG = FrmThanhToanService.LAY_MA_TEN_KHACHHANG_FROM_ORACLE(_NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.MAKHACHHANG); } else { MA_TEN_KHACHHANG = FrmThanhToanService.LAY_MA_TEN_KHACHHANG_FROM_SQLSERVER(_NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.MAKHACHHANG); } using (frmPrintBill_TraLai frmBanTraLai = new frmPrintBill_TraLai()) { try { BILL_DTO infoBill = new BILL_DTO() { ADDRESS = Session.Session.CurrentAddress, CONLAI = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.TIENTRALAI, PHONE = Session.Session.CurrentPhone, MAKH = MA_TEN_KHACHHANG, DIEM = 0, INFOTHUNGAN = "THU NGÂN: " + _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.NGUOITAO + "\t QUẦY: " + _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.MAQUAYBAN, MAGIAODICH = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.MAGIAODICH, THANHTIENCHU = TONGTIEN_BANGCHU, TIENKHACHTRA = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.TIENKHACHDUA, QUAYHANG = _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL.MAQUAYBAN, }; frmBanTraLai.PrintInvoice_BanLeTraLai(infoBill, _NVGDQUAY_ASYNCCLIENT_BILL_GLOBAL); } catch { } finally { this.handler(true); this.Dispose(); frmBanTraLai.Dispose(); frmBanTraLai.Refresh(); } } } catch (Exception ex) { WriteLogs.LogError(ex); } }