/// <summary> /// 窗体Load事件 /// </summary> private void frmOutStorageStat_WestemMedicineStorage_Load(object sender, EventArgs e) { if (m_value_Param == null) { m_value_Param = new clsMS_OutStorageStatQueryCondition_VO(); } m_value_Param.m_blnPharmacyMedicineCancel = false; m_value_Param.m_blnStorageMedicineCancel = false; m_value_Param.m_intOutStorageType = 0; m_value_Param.m_strReceiveDept = ""; m_value_Param.m_dtmOutStorageBeginDate = ""; m_value_Param.m_dtmOutStorageEndDate = ""; m_value_Param.m_strStorageID = m_strStorageID; txtOutStorageBeginDate.Text = DateTime.Now.AddMonths(-1).ToString("yyyy年MM月dd日"); txtOutStorageEndDate.Text = DateTime.Now.ToString("yyyy年MM月dd日"); dwOutStorageStat.LibraryList = clsPublic.PBLPath; //库名 dwOutStorageStat.DataWindowObject = p_strReportName == "" ? "outstoragestat" : "outstoragestat_" + p_strReportName; //库中的对象名 dwOutStorageStat.PrintProperties.Prompt = true; dwOutStorageStat.Modify("title_t_1.text='出库统计报表(" + p_strStorageName + ")'"); dwOutStorageStat.Modify(@"t_9.text=' '"); //dwOutStorageStat.Enabled = false; m_mthGetMedicineTypeSet(); //dwOutStorageStat.PrintProperties.Preview = true; //dwOutStorageStat.PrintProperties.ShowPreviewButtons = true; //dwOutStorageStat.PrintProperties.ShowPreviewOutline = true; }
public long m_lngGetResultByOutStorageStat(ref clsMS_OutStorageStatQueryCondition_VO objvalue_Param, ref DataTable dtbResult) { long lngRes = 0; //com.digitalwave.iCare.middletier.HIS.clsDemoMiddleTierSVC objSvc =(com.digitalwave.iCare.middletier.HIS.clsDemoMiddleTierSVC)clsObjectGenerator.objCreatorObjectByType(typeof(com.digitalwave.iCare.middletier.HIS.clsDemoMiddleTierSVC)); //创建中间件COM对象 com.digitalwave.iCare.middletier.MedicineStoreService.clsOutStorageStatSvc objSvc = (com.digitalwave.iCare.middletier.MedicineStoreService.clsOutStorageStatSvc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(com.digitalwave.iCare.middletier.MedicineStoreService.clsOutStorageStatSvc)); lngRes = objSvc.m_lngGetOutStorageStatData(objPrincipal, ref objvalue_Param, ref dtbResult); return(lngRes); }
/// <summary> /// 查询条件保存在“clsMS_OutStorageStatQueryCondition_VO”类型对象中 /// </summary> private void GetOutStorageStatData() { long lngRes = 0; if (m_value_Param == null) { m_value_Param = new clsMS_OutStorageStatQueryCondition_VO(); } m_value_Param.m_blnPharmacyMedicineCancel = false; m_value_Param.m_blnStorageMedicineCancel = false; m_value_Param.m_intOutStorageType = 0; m_value_Param.m_strReceiveDept = ""; m_value_Param.m_dtmOutStorageBeginDate = ""; m_value_Param.m_dtmOutStorageEndDate = ""; m_value_Param.m_strStorageID = m_strStorageID; if ((txtOutStorageBeginDate.Text.Trim().Length == 11) && (txtOutStorageEndDate.Text.Trim().Length == 11)) { if ((Convert.ToDateTime(txtOutStorageBeginDate.Text)) > (Convert.ToDateTime(txtOutStorageEndDate.Text))) { MessageBox.Show("出库开始日期必须小于或等于出库结束日期!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); txtOutStorageBeginDate.Focus(); return; } } if (txtOutStorageBeginDate.Text.Trim().Length == 11) { string strDate = txtOutStorageBeginDate.Text; m_value_Param.m_dtmOutStorageBeginDate = Convert.ToDateTime(strDate).ToString("yyyy-MM-dd 00:00:00"); } else { m_value_Param.m_dtmOutStorageBeginDate = ""; } if (txtOutStorageEndDate.Text.Trim().Length == 11) { string strDate = txtOutStorageEndDate.Text; m_value_Param.m_dtmOutStorageEndDate = Convert.ToDateTime(strDate).ToString("yyyy-MM-dd 23:59:59"); } else { m_value_Param.m_dtmOutStorageEndDate = ""; } m_value_Param.m_blnPharmacyMedicineCancel = chkPharmacyMedicineCancel.Checked; m_value_Param.m_intOutStorageType = 0; if (m_txtAskDeptPage1.Text.Length > 0) { m_value_Param.m_strReceiveDept = m_txtAskDeptPage1.StrItemId; } else { m_value_Param.m_strReceiveDept = "all"; } int intMedicineTypeSetID = -1; if (m_cboType.SelectedItem != null) { clsMS_MedicineTypeSetVO objSet = m_cboType.SelectedItem as clsMS_MedicineTypeSetVO; if (objSet != null) { intMedicineTypeSetID = objSet.m_intMedicineTypeSetID; m_value_Param.m_intMedicineTypeSetID = objSet.m_intMedicineTypeSetID; } } clsDomainController_OutStorageStat objDomain = new clsDomainController_OutStorageStat(); //调用Com+服务端 DataTable dtbOut = null; //出库数据 DataTable dtbWithin = null; //内退数据 lngRes = objDomain.m_lngGetResultByOutStorageStat(ref m_value_Param, ref dtbOut); if (chkPharmacyMedicineCancel.Checked) { string strDeptID = string.Empty; if (!string.IsNullOrEmpty(m_txtAskDeptPage1.Text) && !string.IsNullOrEmpty(m_txtAskDeptPage1.StrItemId)) { strDeptID = m_txtAskDeptPage1.StrItemId; } lngRes = objDomain.m_lngGetWithinWithdrawal(m_strStorageID, Convert.ToDateTime(Convert.ToDateTime(txtOutStorageBeginDate.Text).ToString("yyyy-MM-dd 00:00:00")), Convert.ToDateTime(Convert.ToDateTime(txtOutStorageEndDate.Text).ToString("yyyy-MM-dd 23:59:59")), strDeptID, intMedicineTypeSetID, out dtbWithin); } if (lngRes <= 0) { dtbResult = null; return; } dtbResult = m_dtbMergeStatisticsData(dtbOut, dtbWithin); }
public long m_lngGetOutStorageStatData(System.Security.Principal.IPrincipal p_objPrincipal, ref clsMS_OutStorageStatQueryCondition_VO objvalue_Param, ref DataTable dtbResult) { long lngRes = 0; IDataParameter[] objDPArr = null; IDataParameter[] tmp_objDPArr = null; //权限控制,clsPrivilegeHandleService为权限处理服务类 com.digitalwave.security.clsPrivilegeHandleService objHandle = new clsPrivilegeHandleService(); lngRes = objHandle.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.MedicineStoreService.clsOutStorageStatSvc", "m_lngGetOutStorageStatData"); if (lngRes < 0) { return(-1); } //创建COM对象 com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); // StringBuilder strSQL = new StringBuilder(@"select // b.askdept_chr, // a.deptname_vchr, // sum(c.callprice_int*c.netamount_int) callsum, // sum(c.wholesaleprice_int*c.netamount_int) wholesalesum, // sum(c.retailprice_int*c.netamount_int) retailsum, // sum(c.retailprice_int*c.netamount_int - c.callprice_int*c.netamount_int) callretaildifference, // sum(c.retailprice_int*c.netamount_int - c.wholesaleprice_int*c.netamount_int) wholesaleretaildifference // from t_bse_deptdesc a // right outer join t_ms_outstorage b // on a.deptid_chr=b.askdept_chr // inner join t_ms_outstorage_detail c // on b.seriesid_int=c.seriesid2_int // inner join t_bse_medicine d on c.medicineid_chr = d.medicineid_chr // inner join t_ms_medicinetypeset ty on ty.medicinetypeid_chr = // d.medicinetypeid_chr // where (b.status>?) // and (c.status=?)"); StringBuilder strSQL = new StringBuilder(@"select a.deptname_vchr, sum(c.callprice_int*c.netamount_int) callsum, sum(c.wholesaleprice_int*c.netamount_int) wholesalesum, sum(c.retailprice_int*c.netamount_int) retailsum, ex.seriesid_int from t_bse_deptdesc a right outer join t_ms_outstorage b on a.deptid_chr=b.askdept_chr inner join t_ms_outstorage_detail c on b.seriesid_int=c.seriesid2_int inner join t_bse_medicine d on c.medicineid_chr = d.medicineid_chr inner join t_ms_medicinetypeset ty on ty.medicinetypeid_chr = d.medicinetypeid_chr inner join t_ms_exportdept ex on a.deptid_chr = ex.exportdept_chr where (b.status>?) and (c.status=?) and (b.formtype=1)"); try { int m_intParamCount = 0; StringBuilder m_strbCondition = new StringBuilder(""); objHRPSvc.CreateDatabaseParameter(10, out tmp_objDPArr); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = 1; ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = 1; if (objvalue_Param.m_strStorageID.Length > 0) { strSQL.Append(@" and (b.storageid_chr=?)"); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = objvalue_Param.m_strStorageID; } if (objvalue_Param.m_dtmOutStorageBeginDate.Length > 0) { strSQL.Append(@" and (b.examdate_dat>=?)"); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = Convert.ToDateTime(objvalue_Param.m_dtmOutStorageBeginDate); tmp_objDPArr[m_intParamCount - 1].DbType = DbType.Date; } if (objvalue_Param.m_dtmOutStorageEndDate.Length > 0) { strSQL.Append(@" and (b.examdate_dat<=?)"); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = Convert.ToDateTime(objvalue_Param.m_dtmOutStorageEndDate); tmp_objDPArr[m_intParamCount - 1].DbType = DbType.Date; } if (objvalue_Param.m_strReceiveDept != "all") { strSQL.Append(@" and (b.askdept_chr=?)"); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = objvalue_Param.m_strReceiveDept; } ////统计是否药房外退 //if (objvalue_Param.m_blnPharmacyMedicineCancel == false) //{ // strSQL.Append(@" and (b.formtype=?)"); // ++m_intParamCount; // tmp_objDPArr[m_intParamCount - 1].Value = 1; //} //else //{ //strSQL.Append(@" and (b.formtype in (?,?))"); //strSQL.Append(@" and ((b.formtype = ?) or (b.formtype = ?))"); //++m_intParamCount; //tmp_objDPArr[m_intParamCount - 1].Value = 1; //++m_intParamCount; //tmp_objDPArr[m_intParamCount - 1].Value = 2; //} if (objvalue_Param.m_intMedicineTypeSetID > 0) { strSQL.Append(@" and ty.medicinetypesetid = ?"); ++m_intParamCount; tmp_objDPArr[m_intParamCount - 1].Value = objvalue_Param.m_intMedicineTypeSetID; } strSQL.Append(@" group by a.deptname_vchr,ex.seriesid_int"); strSQL.Append(@" order by ex.seriesid_int"); objHRPSvc.CreateDatabaseParameter(m_intParamCount, out objDPArr); for (int i1 = 0; i1 < m_intParamCount; i1++) { objDPArr[i1].Value = tmp_objDPArr[i1].Value; objDPArr[i1].DbType = tmp_objDPArr[i1].DbType; } lngRes = objHRPSvc.lngGetDataTableWithParameters(strSQL.ToString(), ref dtbResult, objDPArr); //lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL, ref dtbResult); }//try catch (Exception objEx) { string strTmp = objEx.Message; com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); bool blnRes = objLogger.LogError(objEx); } finally { objHRPSvc.Dispose(); objDPArr = null; tmp_objDPArr = null; objvalue_Param = null; } return(lngRes); }