private void btnQuery_Click(object sender, EventArgs e) { lblInvoCount.Text = ""; lblInvoMoney.Text = ""; dgvInvoList_NotPrint.Rows.Clear(); bool blnHavePirnt = chkHavePrint.Checked; DateTime dtmInvoDate_Start = DateTime.MinValue; DateTime dtmInvoDate_End = DateTime.MinValue; if (chkInvoDate.Checked) { dtmInvoDate_Start = dtpInvoDate_Start.Value.Date; dtmInvoDate_End = dtpInvoDate_End.Value.Date.AddDays(1).AddSeconds(-1); } clsPublic.PlayAvi("findFILE.avi", "正在查询,请稍候..."); try { DataTable dtbResult = null; #region 中间件操作 clsOPChargeQuerySvc objServ = null; long lngRes = -1; try { objServ = (clsOPChargeQuerySvc)clsObjectGenerator.objCreatorObjectByType(typeof(clsOPChargeQuerySvc)); //to do lngRes = objServ.m_lngGetSelfHelpInvo_NotPrint(blnHavePirnt, dtmInvoDate_Start, dtmInvoDate_End, this.txtEmpNo.Text.ToString().Trim(), out dtbResult); } catch (Exception exp) { clsLogText objLogger = new clsLogText(); objLogger.LogError("连接中间件clsOPCharge_SupportedSvc)操作异常," + exp.Message); } finally { if (objServ != null) { objServ.Dispose(); objServ = null; } } #endregion if (dtbResult != null && dtbResult.Rows.Count > 0) { int intRowsCount = dtbResult.Rows.Count; dgvInvoList_NotPrint.Rows.Add(intRowsCount); decimal decTotalMoney = 0; for (int i1 = 0; i1 < intRowsCount; i1++) { DataRow dtrTemp = dtbResult.Rows[i1]; dgvInvoList_NotPrint.Rows[i1].Cells[colInvoDate.Name].Value = dtrTemp["invodate"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Cells[colInvoNo.Name].Value = dtrTemp["invono"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Cells[colChargeEmpName.Name].Value = dtrTemp["chargeempname"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Cells[colPatientCard.Name].Value = dtrTemp["patientcard"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Cells[colPatientName.Name].Value = dtrTemp["patientname"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Cells[colPayTypeName.Name].Value = dtrTemp["paytpyename"].ToString().Trim(); decimal decTemp = ConvertObjToDecimal(dtrTemp["invomoney"].ToString().Trim()); decTotalMoney += decTemp; dgvInvoList_NotPrint.Rows[i1].Cells[colInvoMoney.Name].Value = decTemp.ToString(); dgvInvoList_NotPrint.Rows[i1].Cells[colRepInvoNo.Name].Value = dtrTemp["repinvono"].ToString().Trim(); dgvInvoList_NotPrint.Rows[i1].Tag = dtrTemp; } lblInvoCount.Text = intRowsCount.ToString(); lblInvoMoney.Text = decTotalMoney.ToString(); } } finally { // iCare.Opd.Base.Gui.ProgressBar.Hide(); clsPublic.CloseAvi();//.PlayAvi("findFILE.avi", "正在查询,请稍候..."); } }
private void btnBulkPrint_Click(object sender, EventArgs e) { if (dgvInvoList_NotPrint.Rows.Count == 0) { return; } string strEmpId = this.LoginInfo.m_strEmpID; // iCareBase.Global.Info.clsGlobalValueTool.m_ObjGlobalEmployee.m_strEMPID_CHR; string strEmpName = this.LoginInfo.m_strEmpName; // iCare.Base.Global.Info.clsGlobalValueTool.m_ObjGlobalEmployee.m_strLASTNAME_VCHR; string strHospitalId = ""; //iCare.Base.Global.Info.clsGlobalValueTool.m_OblGlobalHospital.m_strHOSPITALID_CHR; Dictionary <string, string> dictRePrint = new Dictionary <string, string>(); foreach (DataGridViewRow dgvrTemp in dgvInvoList_NotPrint.Rows) { if (dgvrTemp.Tag == null) { continue; } DataRow dtrTemp = dgvrTemp.Tag as DataRow; string strSeqId = dtrTemp["seqid"].ToString().Trim(); string strOldInvoNo = dtrTemp["invono"].ToString().Trim(); if (!dictRePrint.ContainsKey(strSeqId)) { dictRePrint.Add(strSeqId, strOldInvoNo); } } if (dictRePrint.Count == 0) { return; } frmInvoiceBulkPrint_SetInvoRange objForm = new frmInvoiceBulkPrint_SetInvoRange(strHospitalId, strEmpId, strEmpName, dictRePrint.Count); if (objForm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } if (objForm.NewRePrintInvoList.Count == 0) { return; } clsPublic.PlayAvi("findFILE.avi", "正在打印,请稍候..."); try { // iCare.Opd.Base.Gui.clsOpdInvoice objInvo = new iCare.Opd.Base.Gui.clsOpdInvoice(); // iCare.Opd.Print.Invoice.Gui.clsChargeInvoicePrinter objInvo_prt = new iCare.Opd.Print.Invoice.Gui.clsChargeInvoicePrinter(); string strCurrentNewRePrintInvo = ""; int intHavePrintCount = 0; int intIndex = -1; foreach (string strSeqId in dictRePrint.Keys) { ++intIndex; if (intIndex >= objForm.NewRePrintInvoList.Count) { break; } string strOldInvo = dictRePrint[strSeqId]; string strNewRePrintInvo = objForm.NewRePrintInvoList[intIndex]; // clsOPChargeSvc objOpchar = new clsOPChargeSvc(); // long l = objOpchar.m_lngSaveinvorepeatprninfo("1", strSeqId, strOldInvo, strNewRePrintInvo, strEmpId); //// long l = objInvo.m_lngSaveRepeatPrintInoviceNo(strHospitalId, 1, strSeqId, strOldInvo, strNewRePrintInvo, strEmpId); // if (l != 1) // { // MessageBox.Show("保存发票重打信息失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // break; // } try { if (strNewRePrintInvo == "" || strNewRePrintInvo == null) { // objInvo_prt.RepeatNo = "+";//+代表重打发票 } else { // objInvo_prt.RepeatNo = strNewRePrintInvo; } clsOPChargeQuerySvc objChar = new clsOPChargeQuerySvc(); clsCalcPatientCharge objCalPatientCharge = new clsCalcPatientCharge(objChar.m_mthGetHospitalName()); objCalPatientCharge.m_mthBulkReprintinvoice(strSeqId, strEmpId, 0, strOldInvo, strNewRePrintInvo); // objInvo_prt.m_mthPrint(strOldInvo, false); } catch { MessageBox.Show("新发票号(" + strNewRePrintInvo + ")已保存发票重打信息成功,但打印失败,请凭该发票号使用重打发票功能重打该发票。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } strCurrentNewRePrintInvo = strNewRePrintInvo; ++intHavePrintCount; } if (strCurrentNewRePrintInvo != "") { // bool blnSuccess = objInvo.m_blnSaveCurrInvoiceNo(strEmpId, strCurrentNewRePrintInvo, 3); //if (!blnSuccess) //{ // MessageBox.Show("保存当前发票号码失败。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //} } // iCare.Pub.Utility.clsMessageBox.Show("已成功打印" + intHavePrintCount + "张发票,尚未打印" + (dictRePrint.Count - intHavePrintCount) + "张发票。"); //objInvo = null; // objInvo_prt = null; } finally { clsPublic.CloseAvi(); } btnQuery_Click(null, null); }
private void btnOK_Click(object sender, EventArgs e) { this.NewRePrintInvoList.Clear(); string strP2 = ""; bool blnContainsChar = this.txtP2.Visible; if (blnContainsChar) { strP2 = this.txtP2.Text.Trim(); if (strP2 == string.Empty || strP2.Length != 2) { MessageBox.Show("发票号码前面两字母输入不正确,请重新输入。");//need modify this.txtP2.Focus(); this.txtP2.SelectAll(); return; } } string strMinNo = this.txtMinNo.Text.Trim(); //if (strMinNo == string.Empty || strMinNo.Length != clsOpdInvoice.InvoNumeralMaxLength || !iCare.Opd.Base.Gui.clsOpdPublic.m_blnIsNumber(strMinNo)) if (strMinNo == string.Empty) { MessageBox.Show("最小发票号码输入不正确,请重新输入。"); this.txtMinNo.Focus(); this.txtMinNo.SelectAll(); return; } string strMaxNo = this.txtMaxNo.Text.Trim(); if (strMaxNo == string.Empty) { MessageBox.Show("最大发票号码输入不正确,请重新输入。"); this.txtMaxNo.Focus(); this.txtMaxNo.SelectAll(); return; } if (ConvertObjToDecimal(strMinNo) > ConvertObjToDecimal(strMaxNo)) { MessageBox.Show("最小发票号码不能大于最大发票号码,请重新输入。"); this.txtMaxNo.Focus(); this.txtMaxNo.SelectAll(); return; } long lngInvoCount = 0; try { lngInvoCount = Convert.ToInt64(lblInvoCount.Tag.ToString()); } catch { lngInvoCount = 0; } if (lngInvoCount == 0) { MessageBox.Show("设置的发票张数为0,请重新输入。"); this.txtMinNo.Focus(); this.txtMinNo.SelectAll(); return; } //if (!clsOpdInvoice.m_blnIsInvoScopeInAssignRange(blnContainsChar, m_strEmpID, strP2 + strMinNo, strP2 + strMaxNo)) //{//验证是否在分配的发票段中 // this.txtMinNo.Focus(); // this.txtMinNo.SelectAll(); // return; //} if (this.m_lngPrintNeedInvoCount > lngInvoCount) { if (MessageBox.Show("设置的发票数(" + lngInvoCount + ")少于需要打印的发票数(" + this.m_lngPrintNeedInvoCount + "),只能按顺序打印" + lngInvoCount + "张发票。\r\n\r\n是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) { this.txtMinNo.Focus(); this.txtMinNo.SelectAll(); return; } this.m_lngPrintNeedInvoCount = lngInvoCount; } try { clsOPChargeQuerySvc objInvo = new clsOPChargeQuerySvc(); long lngMinInvo = Convert.ToInt64(txtMinNo.Text.Trim()); for (long i1 = 0; i1 < this.m_lngPrintNeedInvoCount; i1++) { string strNewRePrintInvo = strP2 + (lngMinInvo + i1).ToString().PadLeft(8, '0'); if (objInvo.m_blnCheckInvoice(strNewRePrintInvo)) { MessageBox.Show("设置的发票段中存在已被使用的发票号(" + strNewRePrintInvo + "),请重新输入。"); this.txtMinNo.Focus(); this.txtMinNo.SelectAll(); this.NewRePrintInvoList.Clear(); return; } this.NewRePrintInvoList.Add(strNewRePrintInvo); } } catch { this.NewRePrintInvoList.Clear(); } DialogResult = System.Windows.Forms.DialogResult.OK; }