public static void InPhieuKCB_DV(DataTable m_dtReport, string sTitleReport,string KhoGiay) { ReportDocument reportDocument=new ReportDocument(); string tieude="", reportname = ""; switch (KhoGiay) { case "A4": reportDocument =Utility.GetReport("tiepdon_PhieuKCB_Dvu_A4",ref tieude,ref reportname); break; case "A5": reportDocument = Utility.GetReport("tiepdon_PhieuKCB_Dvu_A5" ,ref tieude,ref reportname); break; } if (reportDocument == null) return; var crpt = reportDocument; var objForm = new frmPrintPreview(sTitleReport, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true); try { m_dtReport.AcceptChanges(); crpt.SetDataSource(m_dtReport); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " PHÒNG TIẾP ĐÓN ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); Utility.SetParameterValue(crpt,"Phone", globalVariables.Branch_Phone + globalVariables.SOMAYLE); Utility.SetParameterValue(crpt,"Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(crpt,"sTitleReport", sTitleReport); Utility.SetParameterValue(crpt,"BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInPhieuKCB, PropertyLib._MayInProperties.PreviewPhieuKCB)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInPhieuKCB, 0); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInPhieuKCB; crpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { Utility.ShowMsg(ex.ToString()); } }
public static void InphieuChidinhCLS(int id_benhnhan,string ma_luotkham, int v_AssignId, string v_AssignCode,string nhomincls,int selectedIndex, bool inTach ,ref string mayin) { try { mayin = ""; KcbChidinhcl objAssignInfo = KcbChidinhcl.FetchByID(v_AssignId); DataTable dt = new KCB_THAMKHAM().KcbThamkhamLaydulieuInphieuCls(id_benhnhan, ma_luotkham, v_AssignCode, nhomincls).Tables[0]; if (dt == null || dt.Rows.Count <= 0) { Utility.ShowMsg("Không có dữ liệu in. Mời bạn kiểm tra lại"); return; } THU_VIEN_CHUNG.CreateXML(dt,"Thamkham_InphieuCLS.XML"); Utility.UpdateLogotoDatatable(ref dt); Utility.CreateBarcodeData(ref dt, v_AssignCode); var crpt = new ReportDocument(); string KhoGiay = "A5"; bool inchung = false; string tieude = "", reportname = ""; if (PropertyLib._MayInProperties.CoGiayInCLS == Papersize.A4) KhoGiay = "A4"; if (KhoGiay == "A5") if (inTach && selectedIndex == 0)//Nếu in riêng mà chọn tất crpt = Utility.GetReport("thamkham_InphieuchidinhCLS_RIENG_A5", ref tieude, ref reportname); else { inchung = true; crpt = Utility.GetReport("thamkham_InphieuchidinhCLS_A5", ref tieude, ref reportname); } else//Khổ giấy A4 if (inTach && selectedIndex == 0)//Nếu in riêng mà chọn tất-->Gọi báo cáo nhóm theo nhóm in crpt = Utility.GetReport("thamkham_InphieuchidinhCLS_RIENG_A4", ref tieude, ref reportname); else { inchung = true; crpt = Utility.GetReport("thamkham_InphieuchidinhCLS_A4", ref tieude, ref reportname); } if (crpt == null) return; if (inchung) { List<string> lstNhominCLS = (from p in dt.AsEnumerable() where Utility.DoTrim(Utility.sDbnull(p.Field<string>("nhom_in_cls"))) != "" select p.Field<string>("nhom_in_cls") ).Distinct().ToList<string>(); if (lstNhominCLS.Count > 1) { string tenphieuchidinh = THU_VIEN_CHUNG.Laygiatrithamsohethong("CLS_TENPHIEU_INCHUNG", "PHIẾU CHỈ ĐỊNH CẬN LÂM SÀNG", true); ; foreach (DataRow dr in dt.Rows) dr["ten_nhominphieucls"] = tenphieuchidinh; } } var objForm = new frmPrintPreview("IN PHIẾU CHỈ ĐỊNH", crpt, true, true); try { crpt.SetDataSource(dt); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên Bác sĩ chỉ định ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address); if (!inTach && selectedIndex == 0) { foreach (DataRow dr in dt.Rows) dr[VKcbChidinhcl.Columns.TenNhominphieucls] = THU_VIEN_CHUNG.Laygiatrithamsohethong("TIEUDE_PHIEUCHIDNHCLS_INCHUNG", "PHIẾU CHỈ ĐỊNH", true); } else { Utility.SetParameterValue(crpt, "TitleReport", tieude); } Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate, globalVariables.gv_strDiadiem)); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInCLS)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); mayin = PropertyLib._MayInProperties.TenMayInBienlai; } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; mayin = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { // Utility.DefaultNow(this); } } catch { } }
private void PrintPres(int PresID) { try { DataTable dataTable = this._KEDONTHUOC.LaythongtinDonthuoc_In(PresID); if (dataTable.Rows.Count <= 0) { Utility.ShowMsg("không tìm thấy thuốc, Có thể bạn chưa lưu được thuốc, \nMời bạn kiểm tra lại", "thông báo", MessageBoxIcon.Exclamation); return; } Utility.AddColumToDataTable(ref dataTable, "BarCode", typeof(byte[])); THU_VIEN_CHUNG.CreateXML(dataTable, "thamkham_InDonthuocA4.xml"); this.barcode.Data = Utility.sDbnull(this.txtPres_ID.Text); byte[] buffer = Utility.GenerateBarCode(this.barcode); string str = ""; string str2 = ""; if ((dataTable != null) && (dataTable.Rows.Count > 0)) { } foreach (DataRow row in dataTable.Rows) { row["BarCode"] = buffer; row["chan_doan"] = (Utility.sDbnull(row["chan_doan"]).Trim() == "") ? str : (Utility.sDbnull(row["chan_doan"]) + ";" + str); row["ma_icd"] = str2; } dataTable.AcceptChanges(); Utility.UpdateLogotoDatatable(ref dataTable); string str3 = "A5"; if (PropertyLib._MayInProperties.CoGiayInDonthuoc == Papersize.A4) { str3 = "A4"; } ReportDocument document = new ReportDocument(); string tieude = ""; string fileName = ""; string str6 = str3; if (str6 != null) { if (!(str6 == "A5")) { if (str6 == "A4") { document = Utility.GetReport("thamkham_InDonthuocA4", ref tieude, ref fileName); goto Label_0252; } } else { document = Utility.GetReport("thamkham_InDonthuocA5", ref tieude, ref fileName); goto Label_0252; } } document = Utility.GetReport("thamkham_InDonthuocA5", ref tieude, ref fileName); Label_0252: if (document != null) { Utility.WaitNow(this); ReportDocument rptDoc = document; frmPrintPreview preview = new frmPrintPreview("IN ĐƠN THUỐC BỆNH NH\x00c2N", rptDoc, true, true); try { rptDoc.SetDataSource(dataTable); Utility.SetParameterValue(rptDoc, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(rptDoc, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(rptDoc, "Address", globalVariables.Branch_Address); Utility.SetParameterValue(rptDoc, "Phone", globalVariables.Branch_Phone); Utility.SetParameterValue(rptDoc, "ReportTitle", "ĐƠN THUỐC"); Utility.SetParameterValue(rptDoc, "CurrentDate", Utility.FormatDateTime(this.dtNgayIn.Value)); Utility.SetParameterValue(rptDoc, "BottomCondition", THU_VIEN_CHUNG.BottomCondition()); preview.crptViewer.ReportSource = rptDoc; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInDonthuoc)) { preview.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); preview.ShowDialog(); this.cboLaserPrinters.Text = PropertyLib._MayInProperties.TenMayInBienlai; } else { preview.addTrinhKy_OnFormLoad(); rptDoc.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; rptDoc.PrintToPrinter(1, false, 0, 0); } Utility.DefaultNow(this); } catch (Exception) { Utility.DefaultNow(this); } } } catch(Exception ex) { Utility.CatchException(ex); } }
private void INPHIEU_XETNGHIEM(bool IsQuick, string sTitleReport, DateTime NgayIn) { string strPatient_ID = string.Empty; var DTPrint = new DataTable(); string vTestTypeId; //= GetCheckTestType(); string vTestID ;//= GetcheckTestID(); string Test_ID = "-1"; string TestType = "-1"; foreach (GridEXRow gridExRow in grdTestInfo.GetCheckedRows()) { TestType += "," + Utility.sDbnull(gridExRow.Cells[TTestTypeList.Columns.TestTypeId].Value, "-1"); Test_ID += "," + Utility.sDbnull(gridExRow.Cells[TTestInfo.Columns.TestId].Value, "-1"); } vTestTypeId = TestType; vTestID = Test_ID; if (vTestTypeId == "-1") { Utility.ShowMsg("Chưa chọn loại xét nghiệm để in"); return; } strPatient_ID = Utility.sDbnull(grdTestInfo.GetValue("Patient_ID")); DTPrint = SPs.GtvtGetTestResultForPrintV2FromDateToDate(strPatient_ID, vTestTypeId, vTestID,dtpTestDateFrom.Value.ToShortDateString(), dtpTestDateTo.Value.ToShortDateString()).GetDataSet().Tables[0]; if (DTPrint.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy bản ghi nào", "Thông báo"); return; } ProcessData(ref DTPrint); if (SysPara.IsNormalResult == 1) { string normalLevel = Utility.Int32Dbnull(DTPrint.Rows[0]["Sex"], 1) == 1 ? "Normal_Level" : "Normal_LevelW"; ProcessNormalResult(ref DTPrint); //ProcessNormalResult(ref DTPrint, "Test_result", normalLevel, -1, 1, 0, // "binhthuong", false); foreach (DataRow row in DTPrint.Rows) { if ( (row["Test_result"].ToString().Trim().ToUpper().StartsWith("ÂM")) || (row["Test_result"].ToString().Trim().ToUpper().Contains("AM")) ) { row["binhthuong"] = -1; } else if ( (row["Test_result"].ToString().Trim().ToUpper().StartsWith("DƯƠ")) || (row["Test_result"].ToString().Trim().ToUpper().Contains("DUO")) ) { row["binhthuong"] = 1; } } } //try //{ // reporttype = File.ReadAllText(filereporttype); // if (chkA5.Checked) // { // StrCode = reporttype; // } // else if (chkA4.Checked) // { // StrCode = reporttype; // } //} //catch (Exception ex) //{ // MessageBox.Show("Loz" + ex, "Thông báo"); //} string tieude = "", reportname = ""; var crpt = Utility.GetReport("LAOKHOA_crpt_DetailTestReport_TESTTYPE", ref tieude, ref reportname); var objForm = new frmPrintPreview(sTitleReport, crpt, true, DTPrint.Rows.Count <= 0 ? false : true); Utility.UpdateLogotoDatatable(ref DTPrint); try { DTPrint.AcceptChanges(); crpt.SetDataSource(DTPrint); objForm.crptViewer.ReportSource = crpt; ////crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " PHÒNG TIẾP ĐÓN ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); objForm.crptTrinhKyName = Path.GetFileName(reportname); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "sCurrentDate", Date(NgayIn)); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition()); if (IsQuick) { objForm.ShowDialog(); // Utility.DefaultNow(this); } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = printDocument.PrinterSettings.PrinterName; crpt.PrintToPrinter(0, true, 0, 0); crpt.Dispose(); CleanTemporaryFolders(); } } catch (Exception ex) { if (globalVariables.IsAdmin) { Utility.ShowMsg(ex.ToString()); } } }
void cmdIn_Click(object sender, EventArgs e) { try { if (objLuotkham==null) { Utility.ShowMsg("Bạn cần chọn bệnh nhân in phiếu tạm ứng"); return; } if (grdTamung.GetDataRows().Count() <= 0) { Utility.ShowMsg("Bạn cần chọn phiếu tạm ứng muốn in"); return; } if (!Utility.isValidGrid(grdTamung)) { grdTamung.MoveFirst(); } DataTable m_dtReport = noitru_TamungHoanung.NoitruInphieutamung(Utility.Int64Dbnull(Utility.GetValueFromGridColumn(grdTamung, NoitruTamung.Columns.Id), -1)); THU_VIEN_CHUNG.CreateXML(m_dtReport, "noitru_phieutamung.xml"); if (m_dtReport.Rows.Count <= 0) { Utility.ShowMsg("Không tìm thấy dữ liệu", "Thông báo", MessageBoxIcon.Warning); return; } string tieude = "", reportname = ""; var crpt = Utility.GetReport("noitru_phieutamung", ref tieude, ref reportname); if (crpt == null) return; MoneyByLetter _moneyByLetter = new MoneyByLetter(); var objForm = new frmPrintPreview(tieude, crpt, true, m_dtReport.Rows.Count <= 0 ? false : true); Utility.UpdateLogotoDatatable(ref m_dtReport); crpt.SetDataSource(m_dtReport); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "noitru_phieutamung"; Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt, "TelePhone", globalVariables.Branch_Phone); Utility.SetParameterValue(crpt, "sMoneyLetter", _moneyByLetter.sMoneyToLetter(Utility.Int32Dbnull(m_dtReport.Compute("SUM(so_tien)", "1=1"), 0).ToString())); Utility.SetParameterValue(crpt, "sCurrentDate", Utility.FormatDateTimeWithThanhPho(DateTime.Now)); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewPhieuTamung)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(objForm.getPrintNumber, false, 0, 0); } } catch (Exception) { } }
private void PrintPres(int PresID) { DataTable v_dtData =new KCB_KEDONTHUOC().LaythongtinDonthuoc_In(PresID); Utility.AddColumToDataTable(ref v_dtData, "BarCode", typeof(byte[])); //barcode.Data = Utility.sDbnull(Pres_ID); byte[] Barcode = Utility.GenerateBarCode(barcode); string ICD_Name = ""; string ICD_Code = ""; foreach (DataRow drv in v_dtData.Rows) { drv["BarCode"] = Barcode; drv["chan_doan"] =""; drv["ma_icd"] = ""; } THU_VIEN_CHUNG.CreateXML(v_dtData, "thamkham_InDonthuocA4.xml"); v_dtData.AcceptChanges(); // log.Info("Thuc hien in don thuoc"); Utility.UpdateLogotoDatatable(ref v_dtData); string KhoGiay = "A5"; if (PropertyLib._MayInProperties.CoGiayInDonthuoc == Papersize.A4) KhoGiay = "A4"; ReportDocument reportDocument = new ReportDocument(); string tieude = "", reportname = "",reportCode=""; switch (KhoGiay) { case "A5": reportCode = "quaythuoc_InDonthuocA5"; reportDocument = Utility.GetReport("quaythuoc_InDonthuocA5", ref tieude, ref reportname); break; case "A4": reportCode = "quaythuoc_InDonthuocA4"; reportDocument = Utility.GetReport("quaythuoc_InDonthuocA4", ref tieude, ref reportname); break; default: reportCode = "quaythuoc_InDonthuocA4"; reportDocument = Utility.GetReport("quaythuoc_InDonthuocA4", ref tieude, ref reportname); break; } if (reportDocument == null) return; //v_dtData.AcceptChanges(); Utility.WaitNow(this); ReportDocument crpt = reportDocument; var objForm = new frmPrintPreview("IN ĐƠN THUỐC BỆNH NHÂN", crpt, true, true); try { objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = reportCode; crpt.SetDataSource(v_dtData); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt, "Phone", globalVariables.Branch_Phone); Utility.SetParameterValue(crpt, "ReportTitle", tieude); Utility.SetParameterValue(crpt, "CurrentDate", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(crpt, "BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInDonthuoc)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); cbomayinphoiBHYT.Text = PropertyLib._MayInProperties.TenMayInBienlai; } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } Utility.DefaultNow(this); } catch (Exception ex) { Utility.DefaultNow(this); } }
private bool IN_TTAT_DTRI_NGOAITRU() { try { string ICD_Name = ""; string ICD_Code = ""; DataSet dsData = _KCB_THAMKHAM.LaythongtinInphieuTtatDtriNgoaitru(objkcbdangky.IdKham); THU_VIEN_CHUNG.CreateXML(dsData); string NGAY_KEDON = ""; string[] arrDate = Utility.sDbnull( dsData.Tables[2].Rows.Count > 0 ? dsData.Tables[2].Rows[0]["NGAY_KEDON"] : globalVariables.SysDate.ToString("dd/MM/yyyy"), globalVariables.SysDate.ToString("dd/MM/yyyy")).Split('/'); NGAY_KEDON = "Ngày " + arrDate[0] + " tháng " + arrDate[1] + " năm " + arrDate[2]; DataTable v_dtData = dsData.Tables[0]; DataTable sub_dtData = getChitietCLS(); THU_VIEN_CHUNG.CreateXML(sub_dtData, "sub_report.xml"); // new DataTable("Temp"); if (v_dtData != null && v_dtData.Rows.Count > 0) GetChanDoan(Utility.sDbnull(v_dtData.Rows[0]["ICD_CHINH"], ""), Utility.sDbnull(v_dtData.Rows[0]["ICD_PHU"], ""), ref ICD_Name, ref ICD_Code); foreach (DataRow dr in v_dtData.Rows) { dr["chan_doan"] = Utility.sDbnull(dr["chan_doan"]).Trim() == "" ? ICD_Name : Utility.sDbnull(dr["chan_doan"]) + ";" + ICD_Name; //dr[DmucBenh.Columns.MaBenh] = ICD_Code; dr["ma_icd"] = ICD_Code; } v_dtData.AcceptChanges(); v_dtData.AcceptChanges(); Utility.UpdateLogotoDatatable(ref v_dtData); string tieude = "", reportname = ""; ReportDocument crpt = Utility.GetReport("thamkham_InPhieutomtatdieutringoaitru_A4", ref tieude, ref reportname); if (PropertyLib._MayInProperties.CoGiayInTomtatDieutriNgoaitru == Papersize.A5) crpt = Utility.GetReport("thamkham_InPhieutomtatdieutringoaitru_A5", ref tieude, ref reportname); if (crpt == null) return false; var objForm = new frmPrintPreview("PHIẾU TÓM TẮT ĐIỀU TRỊ NGOẠI TRÚ", crpt, true, true); crpt.SetDataSource(v_dtData); crpt.Subreports[0].SetDataSource(sub_dtData); Utility.SetParameterValue(crpt, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt, "NGAY_KEDON", NGAY_KEDON); objForm.crptViewer.ReportSource = crpt; //In ngay if (cboPrintPreviewTomtatdieutringoaitru.SelectedValue.ToString() == "1") objForm.addTrinhKy_OnFormLoad(); if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInTomtatDieutriNgoaitru)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0, 1); objForm.ShowDialog(); } else { crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(2, false, 0, 0); } List<int> lstKho = dsData.Tables[2].AsEnumerable().Select(c => c.Field<int>("id_kho")).Distinct().ToList(); foreach (int s in lstKho) { DataTable dt = v_dtData.Clone(); dt = dsData.Tables[2].Select("id_kho = " + s, "stt_in").CopyToDataTable(); foreach (DataRow dr in dt.Rows) { dr["chan_doan"] = Utility.sDbnull(dr["chan_doan"]).Trim() == "" ? ICD_Name : Utility.sDbnull(dr["chan_doan"]) + ";" + ICD_Name; //dr[DmucBenh.Columns.MaBenh] = ICD_Code; dr["ma_icd"] = ICD_Code; } dt.AcceptChanges(); ReportDocument crpt1 = Utility.GetReport("thamkham_Inphieulinhthuocngoaitru_A4", ref tieude, ref reportname); if (PropertyLib._MayInProperties.CoGiayInTomtatDieutriNgoaitru == Papersize.A5) crpt1 = Utility.GetReport("thamkham_Inphieulinhthuocngoaitru_A5", ref tieude, ref reportname); if (crpt1 == null) return false; var objForm1 = new frmPrintPreview("PHIẾU LĨNH THUỐC NGOẠI TRÚ", crpt1, true, true); crpt1.SetDataSource(dt); crpt1.SetParameterValue("ParentBranchName", globalVariables.ParentBranch_Name); crpt1.SetParameterValue("BranchName", globalVariables.Branch_Name); crpt1.SetParameterValue("NGAY_KEDON", NGAY_KEDON); objForm1.crptViewer.ReportSource = crpt1; if (cboPrintPreviewTomtatdieutringoaitru.SelectedValue.ToString() == "1") objForm1.addTrinhKy_OnFormLoad(); if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInTomtatDieutriNgoaitru)) { objForm1.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0, 2); objForm1.ShowDialog(); Utility.DefaultNow(this); } else { crpt1.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt1.PrintToPrinter(1, false, 0, 0); } } return true; } catch (Exception ex) { Utility.ShowMsg(ex.Message); return false; } }
private void IN_HOADON() { string LyDoIn = "0"; try { if (!Utility.isValidGrid(grdPayment)) return; int payment_ID = Utility.Int32Dbnull(grdPayment.GetValue(KcbThanhtoan.Columns.IdThanhtoan), -1); try { dtPatientPayment = _THANHTOAN.Laythongtinhoadondo(payment_ID); dtPatientPayment.Rows[0]["sotien_bangchu"] = new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(dtPatientPayment.Rows[0]["TONG_TIEN"])); int lengh = txtSerieDau.Text.Length; string tieude="", reportname = ""; var report = Utility.GetReport("thanhtoan_Hoadondo",ref tieude,ref reportname); if (report == null) return; frmPrintPreview objForm = new frmPrintPreview("", report, true, true); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_Hoadondo"; report.PrintOptions.PrinterName = cbomayinhoadon.Text; report.SetDataSource(dtPatientPayment); Utility.SetParameterValue(report, "NGUOIIN", Utility.sDbnull(globalVariables.gv_strTenNhanvien, "")); Utility.SetParameterValue(report, "ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(report, "BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(report, "DateTime", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report, "CurrentDate", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report, "sTitleReport", tieude); //report.SetParameterValue("CharacterMoney", new MoneyByLetter().sMoneyToLetter(TONG_TIEN.ToString())); objForm.crptViewer.ReportSource = report; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInHoadon, PropertyLib._MayInProperties.PreviewInHoadon)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInHoadon, 1); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); report.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInHoadon; report.PrintToPrinter(1,false, 0, 0); } } catch (Exception ex1) { Utility.ShowMsg("Lỗi khi thực hiện in hóa đơn mẫu. Liên hệ IT để được trợ giúp-->" + ex1.Message); } } catch (Exception ex) { Utility.ShowMsg(ex.Message); } }
public void LAOKHOA_INPHIEU_BAOHIEM_NGOAITRU(DataTable m_dtReportPhieuThu, string sTitleReport, DateTime ngayIn, KcbLuotkham objPatientExam) { Utility.UpdateLogotoDatatable(ref m_dtReportPhieuThu); THU_VIEN_CHUNG.Sapxepthutuin(ref m_dtReportPhieuThu,true); m_dtReportPhieuThu.DefaultView.Sort = "THU_TU ASC"; m_dtReportPhieuThu.AcceptChanges(); string tieude="", reportname = ""; var crpt = Utility.GetReport("BHYT_Inphoi" ,ref tieude,ref reportname); if (crpt == null) return; frmPrintPreview objForm = new frmPrintPreview("", crpt, true, true); objForm.NGAY = NGAYINPHIEU; //try //{ crpt.SetDataSource(m_dtReportPhieuThu.DefaultView); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); // Utility.SetParameterValue(crpt,"Telephone", globalVariables.Branch_Phone); // Utility.SetParameterValue(crpt,"Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(ngayIn)); Utility.SetParameterValue(crpt,"sTitleReport", sTitleReport); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "THANH_TIEN").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BH", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "BHCT").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BN", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "BNCT").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_Khac", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "PHU_THU").ToString())); objForm.crptViewer.ReportSource = crpt; objForm.addTrinhKy_OnFormLoad(); try { //if (PropertyLib._HISPrintProperties != null) //{ // if (string.IsNullOrEmpty(PropertyLib._HISPrintProperties.sPrinterNameBHYT)) // { // PropertyLib._HISPrintProperties.sPrinterNameBHYT = Utility.GetDefaultPrinter(); // } // crpt.PrintOptions.PrinterName = PropertyLib._HISPrintProperties.sPrinterNameBHYT; // crpt.PrintToPrinter(PropertyLib._HISPrintProperties.SoLuongCanInBHYT, true, 0, 0); // new Update(KcbLuotkham.Schema).Set(KcbLuotkham.Columns.Locked).EqualTo(1).Where(KcbLuotkham.Columns.MaLuotkham) // .IsEqualTo(objPatientExam.MaLuotkham).Execute(); //} //else //{ //} PrintDialog frmPrint = new PrintDialog(); if (frmPrint.ShowDialog() == DialogResult.OK) { new Update(KcbLuotkham.Schema).Set(KcbLuotkham.Columns.Locked).EqualTo(1).Where(KcbLuotkham.Columns.MaLuotkham) .IsEqualTo(objPatientExam.MaLuotkham).Execute(); crpt.PrintOptions.PrinterName = frmPrint.PrinterSettings.PrinterName; crpt.PrintToPrinter(frmPrint.PrinterSettings.Copies, frmPrint.PrinterSettings.Collate, frmPrint.PrinterSettings.FromPage, frmPrint.PrinterSettings.ToPage); } } catch (Exception exception) { Utility.ShowMsg("Bạn cần cấu hình lại máy in ","Thông báo",MessageBoxIcon.Warning); } //objForm.ShowDialog(); //} //catch (Exception ex) //{ // Utility.DefaultNow(this); //} }
/// <summary> /// hàm thực hiện in phiếu bảo hiểm đúng tuyến /// </summary> /// <param name="sTitleReport"></param> public void LAOKHOA_INPHIEU_BAOHIEM_NGOAITRU(DataTable m_dtReportPhieuThu, string sTitleReport,DateTime ngayIn) { Utility.UpdateLogotoDatatable(ref m_dtReportPhieuThu); THU_VIEN_CHUNG.Sapxepthutuin(ref m_dtReportPhieuThu,true); m_dtReportPhieuThu.DefaultView.Sort = "THU_TU ASC"; m_dtReportPhieuThu.AcceptChanges(); string tieude="", reportname = ""; var crpt = Utility.GetReport("BHYT_InPhoi",ref tieude,ref reportname); if (crpt == null) return; var objForm = new frmPrintPreview("", crpt, true, true); //try //{ crpt.SetDataSource(m_dtReportPhieuThu.DefaultView); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); // Utility.SetParameterValue(crpt,"Telephone", globalVariables.Branch_Phone); // Utility.SetParameterValue(crpt,"Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(ngayIn)); Utility.SetParameterValue(crpt,"sTitleReport", sTitleReport); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "THANH_TIEN").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BH", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "BHCT").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BN", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "BNCT").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_Khac", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "PHU_THU").ToString())); objForm.crptViewer.ReportSource = crpt; objForm.addTrinhKy_OnFormLoad(); PrintDialog frmPrint = new PrintDialog(); if(frmPrint.ShowDialog() == DialogResult.OK) { crpt.PrintOptions.PrinterName = frmPrint.PrinterSettings.PrinterName; crpt.PrintToPrinter(frmPrint.PrinterSettings.Copies,frmPrint.PrinterSettings.Collate,frmPrint.PrinterSettings.FromPage,frmPrint.PrinterSettings.ToPage); } //objForm.ShowDialog(); //} //catch (Exception ex) //{ // Utility.DefaultNow(this); //} }
public void IN_HOADON(int payment_ID) { string LyDoIn = "0"; try { DataTable dtPatientPayment = new KCB_THANHTOAN().Laythongtinhoadondo(payment_ID); dtPatientPayment.Rows[0]["sotien_bangchu"] = new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(dtPatientPayment.Rows[0]["TONG_TIEN"])); string tieude = "", reportname = ""; ReportDocument report = Utility.GetReport("thanhtoan_Hoadondo", ref tieude, ref reportname); if (report == null) return; var objForm = new frmPrintPreview("", report, true, true); //objForm.AutoClose = true; objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_Hoadondo"; report.SetDataSource(dtPatientPayment); Utility.SetParameterValue(report,"NGUOIIN", Utility.sDbnull(globalVariables.gv_strTenNhanvien, "")); Utility.SetParameterValue(report,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(report,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(report,"DateTime", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report,"CurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate,globalVariables.gv_strDiadiem)); Utility.SetParameterValue(report, "sTitleReport", tieude); Utility.SetParameterValue(report, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName,globalVariables.SysDate)); objForm.crptViewer.ReportSource = report; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInHoadon, PropertyLib._MayInProperties.PreviewInHoadon)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInHoadon, 1); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); report.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInHoadon; report.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex1) { Utility.CatchException(ex1); } }
public void INPHOI_BHYT(DataTable m_dtReportPhieuThu, DateTime ngayIn, KcbLuotkham objPatientExam) { Utility.UpdateLogotoDatatable(ref m_dtReportPhieuThu); THU_VIEN_CHUNG.Sapxepthutuin(ref m_dtReportPhieuThu,true); m_dtReportPhieuThu.DefaultView.Sort = "stt_in ,stt_hthi_dichvu,stt_hthi_chitiet,ten_chitietdichvu"; m_dtReportPhieuThu.AcceptChanges(); string tieude="", reportname = ""; var crpt = Utility.GetReport("BHYT_InPhoi" ,ref tieude,ref reportname); if (crpt == null) return; frmPrintPreview objForm = new frmPrintPreview(tieude, crpt, true, true); objForm.NGAY = NGAYINPHIEU; try { objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "BHYT_InPhoi"; crpt.SetDataSource(m_dtReportPhieuThu.DefaultView); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " Nhân viên ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(ngayIn)); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "TT_KHONG_PHUTHU").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BH", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "TT_BHYT").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_BN", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "TT_BN").ToString())); Utility.SetParameterValue(crpt,"sMoneyCharacter_Thanhtien_Khac", sMoneyByLetter.sMoneyToLetter( SumOfTotal_BH(m_dtReportPhieuThu, "TT_PHUTHU").ToString())); Utility.SetParameterValue(crpt, "txtTrinhky", Utility.getTrinhky(objForm.mv_sReportFileName, NGAYINPHIEU)); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInPhoiBHYT)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); if (objForm.ShowDialog() == DialogResult.OK) { //Tự động khóa BN để kết thúc new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiKetthuc).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.Locked).EqualTo(1) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPatientExam.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPatientExam.IdBenhnhan).Execute(); } } else { //Tự động khóa BN để kết thúc new Update(KcbLuotkham.Schema) .Set(KcbLuotkham.Columns.NgayKetthuc).EqualTo(globalVariables.SysDate) .Set(KcbLuotkham.Columns.NguoiKetthuc).EqualTo(globalVariables.UserName) .Set(KcbLuotkham.Columns.Locked).EqualTo(1) .Where(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objPatientExam.MaLuotkham) .And(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objPatientExam.IdBenhnhan).Execute(); objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex) { Utility.CatchException(ex); } }
/// <summary> /// hàm thưc hiện viêc in thông tin của phiếu thu đồng chi trả /// </summary> /// <param name="m_dtReportPhieuThu"></param> /// <param name="NgayInPhieu"></param> /// <param name="sTitleReport"></param> public void INPHIEU_DONGCHITRA(DataTable m_dtReportPhieuThu, DateTime NgayInPhieu, string sTitleReport) { Utility.UpdateLogotoDatatable(ref m_dtReportPhieuThu); string tieude="", reportname = ""; var crpt = Utility.GetReport("thanhtoan_PHIEUTHU_DONGCHITRA",ref tieude,ref reportname); if (crpt == null) return; var objForm = new frmPrintPreview("", crpt, true, true); //try //{ objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_PHIEUTHU_DONGCHITRA"; crpt.SetDataSource(m_dtReportPhieuThu); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); //Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"Phone", globalVariables.Branch_Phone); Utility.SetParameterValue(crpt,"Address", globalVariables.Branch_Address); // Utility.SetParameterValue(crpt,"DateTime", Utility.FormatDateTime(dtCreateDate.Value)); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(NgayInPhieu)); Utility.SetParameterValue(crpt,"sTitleReport", sTitleReport); Utility.SetParameterValue(crpt,"sMoneyLetter", new MoneyByLetter().sMoneyToLetter(SumOfTotal(m_dtReportPhieuThu,"SO_TIEN").ToString())); Utility.SetParameterValue(crpt,"BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInBienlai)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } }
public void INPHIEU_DICHVU(DataTable m_dtReportPhieuThu, DateTime NgayInPhieu,string khogiay) { Utility.UpdateLogotoDatatable(ref m_dtReportPhieuThu); ReportDocument reportDocument = new ReportDocument(); string tieude="", reportname = "",reportCode=""; switch (khogiay) { case "A4": reportCode = "thanhtoan_Bienlai_Dichvu_A4"; reportDocument = Utility.GetReport("thanhtoan_Bienlai_Dichvu_A4",ref tieude,ref reportname); break; case "A5": reportCode = "thanhtoan_Bienlai_Dichvu_A5"; reportDocument = Utility.GetReport("thanhtoan_Bienlai_Dichvu_A5" ,ref tieude,ref reportname); break; } if (reportDocument == null) return; var crpt = reportDocument; var p = (from q in m_dtReportPhieuThu.AsEnumerable() group q by q.Field<long>(KcbThanhtoan.Columns.IdThanhtoan) into r select new { _key = r.Key, tongtien_chietkhau_hoadon = r.Min(g => g.Field<decimal>("tongtien_chietkhau_hoadon")), tongtien_chietkhau_chitiet = r.Min(g => g.Field<decimal>("tongtien_chietkhau_chitiet")), tongtien_chietkhau = r.Min(g => g.Field<decimal>("tongtien_chietkhau")) }).ToList(); decimal tong = m_dtReportPhieuThu.AsEnumerable().Sum(c => c.Field<decimal>("TT_BN")); decimal tong_ck_hoadon = p.Sum(c => c.tongtien_chietkhau_hoadon); decimal tong_ck =p.Sum(c =>c.tongtien_chietkhau); tong = tong - tong_ck; var objForm = new frmPrintPreview("", crpt, true, true); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = reportCode; //try //{ crpt.SetDataSource(m_dtReportPhieuThu.DefaultView); //crpt.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + " ".Replace("#$X$#", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34); Utility.SetParameterValue(crpt,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(crpt,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(crpt,"Telephone", globalVariables.Branch_Phone); Utility.SetParameterValue(crpt,"Address", globalVariables.Branch_Address); Utility.SetParameterValue(crpt,"tienmiengiam_hdon", tong_ck_hoadon); Utility.SetParameterValue(crpt,"tong_miengiam", tong_ck); Utility.SetParameterValue(crpt,"tongtien_bn", tong); // Utility.SetParameterValue(crpt,"DateTime", Utility.FormatDateTime(dtCreateDate.Value)); Utility.SetParameterValue(crpt,"CurrentDate", Utility.FormatDateTime(NgayInPhieu)); Utility.SetParameterValue(crpt, "sTitleReport", tieude); Utility.SetParameterValue(crpt,"sMoneyCharacter", new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(tong))); Utility.SetParameterValue(crpt,"BottomCondition", THU_VIEN_CHUNG.BottomCondition()); objForm.crptViewer.ReportSource = crpt; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInBienlai, PropertyLib._MayInProperties.PreviewInBienlai)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInBienlai, 0); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); crpt.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInBienlai; crpt.PrintToPrinter(1, false, 0, 0); } }
public void InPhieuchi(long payment_ID) { string LyDoIn = "0"; try { DataTable dtPatientPayment = new KCB_THANHTOAN().KcbThanhtoanLaythongtinphieuchi(payment_ID); THU_VIEN_CHUNG.CreateXML(dtPatientPayment, "thanhtoan_phieuchi.xml"); dtPatientPayment.Rows[0]["sotien_bangchu"] = new MoneyByLetter().sMoneyToLetter(Utility.sDbnull(dtPatientPayment.Rows[0]["SO_TIEN"])); string tieude = "", reportname = ""; ReportDocument report = Utility.GetReport("thanhtoan_phieuchi", ref tieude, ref reportname); if (report == null) return; var objForm = new frmPrintPreview("", report, true, true); objForm.mv_sReportFileName = Path.GetFileName(reportname); objForm.mv_sReportCode = "thanhtoan_phieuchi"; report.SetDataSource(dtPatientPayment); Utility.SetParameterValue(report,"NGUOIIN", Utility.sDbnull(globalVariables.gv_strTenNhanvien, "")); Utility.SetParameterValue(report,"ParentBranchName", globalVariables.ParentBranch_Name); Utility.SetParameterValue(report,"BranchName", globalVariables.Branch_Name); Utility.SetParameterValue(report,"DateTime", Utility.FormatDateTime(globalVariables.SysDate)); Utility.SetParameterValue(report,"sCurrentDate", Utility.FormatDateTimeWithLocation(globalVariables.SysDate, globalVariables.gv_strDiadiem)); Utility.SetParameterValue(report, "sTitleReport", tieude); //Utility.SetParameterValue(report,"CharacterMoney", new MoneyByLetter().sMoneyToLetter(TONG_TIEN.ToString())); objForm.crptViewer.ReportSource = report; if (Utility.isPrintPreview(PropertyLib._MayInProperties.TenMayInHoadon, PropertyLib._MayInProperties.PreviewInHoadon)) { objForm.SetDefaultPrinter(PropertyLib._MayInProperties.TenMayInHoadon, 1); objForm.ShowDialog(); } else { objForm.addTrinhKy_OnFormLoad(); report.PrintOptions.PrinterName = PropertyLib._MayInProperties.TenMayInHoadon; report.PrintToPrinter(1, false, 0, 0); } } catch (Exception ex1) { Utility.ShowMsg("Lỗi khi thực hiện in hóa đơn mẫu. Liên hệ IT để được trợ giúp-->" + ex1.Message); } }