Ejemplo n.º 1
0
 public FrmZYFeeQueryControl(IFrmZYFeeQuery frmzyfeequery)
 {
     _frmzyfeequery = frmzyfeequery;
     _queryItemDt   = PublicDataReader.LoadZYFPCode();
     _deptFeeDt     = new DataTable();
     _deptFeeDt.Columns.Add("科室名称", System.Type.GetType("System.String"));
     _deptFeeDt.Columns.Add("presdeptcode", System.Type.GetType("System.String"));
     _deptFeeDt.Columns.Add("总收入", System.Type.GetType("System.Decimal"));
     for (int index = 0; index < _queryItemDt.Rows.Count; index++)
     {
         DataRow fpRow = _queryItemDt.Rows[index];
         _deptFeeDt.Columns.Add(fpRow["item_name"].ToString(), Type.GetType("System.Decimal"));
     }
     _deptFeeDt.PrimaryKey = new DataColumn[] { _deptFeeDt.Columns["presdeptcode"] };
     _docFeeDt             = new DataTable();
     _docFeeDt.Columns.Add("医生名称", System.Type.GetType("System.String"));
     _docFeeDt.Columns.Add("presdoccode", System.Type.GetType("System.String"));
     _docFeeDt.Columns.Add("总收入", System.Type.GetType("System.Decimal"));
     for (int index = 0; index < _queryItemDt.Rows.Count; index++)
     {
         DataRow fpRow = _queryItemDt.Rows[index];
         _docFeeDt.Columns.Add(fpRow["item_name"].ToString(), Type.GetType("System.Decimal"));
     }
     _docFeeDt.PrimaryKey = new DataColumn[] { _docFeeDt.Columns["presdoccode"] };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载基本数据
        /// </summary>
        private void LoadBaseData()
        {
            #region 加载选项卡数据
            int type = 0;
            if (formView.FormAction == 0)
            {
                type = 1;
            }
            else
            {
                type = 0;
            }

            tbShowCardData = PublicDataReader.GetItemSelectedCardDataSource(type);
            //窗体行为:0 - 门诊收费 1 - 门诊划价 2 - 药房划价
            if (formView.FormAction == 2)
            {
                //移除掉非药品的项目
                DataRow[] drs = tbShowCardData.Select("ISDRUG=0");
                for (int i = 0; i < drs.Length; i++)
                {
                    tbShowCardData.Rows.Remove(drs[i]);
                }
            }
            #endregion
            //加载医生
            tbDoctor = BaseDataController.BaseDataSet[BaseDataCatalog.医生列表];
            //加载科室
            tbDepartment = BaseDataController.BaseDataSet[BaseDataCatalog.科室列表];
            //加载模板明细
            tbTemplateDetail = BaseDataController.BaseDataSet[BaseDataCatalog.划价模板明细列表];
        }
Ejemplo n.º 3
0
        public FrmIncomeReport(int OperatorId, string FormTitle)
        {
            InitializeComponent( );

            this.Text      = FormTitle;
            this.FormTitle = FormTitle;

            OperatorName = PublicDataReader.GetEmployeeNameById(OperatorId);
        }
 public void LoadAllClincDept()
 {
     try
     {
         _clincDepts = PublicDataReader.LoadClincDept();
         _formInterface.RefreshClincDept(_clincDepts);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Ejemplo n.º 5
0
 public void LoadInitData()
 {
     try
     {
         _bigItemDt = PublicDataReader.GetBigItemList();
         _hsItemDt  = PublicDataReader.GetHSItemList();
         _frmprjfeequery.RefreshItemTree(_hsItemDt, _bigItemDt);
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Ejemplo n.º 6
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor           = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                btnStat.Enabled  = false;
                btnPrint.Enabled = false;
                btnClose.Enabled = false;
                DateTime beginDate;
                DateTime endDate;
                string   accountIdList;

                ReportController.GetReportBeginDateAndEndDate(StatDateType.交账时间, 25, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);

                BaseReport report = new DoctorIncomeReport();
                report.BeginDate      = beginDate;
                report.EndDate        = endDate;
                report.StatType       = StatClassType.门诊会计分类;
                report.Reportstyle    = ReportStyle.科目为明细行;
                report.StatDateType   = StatDateType.交账时间;
                report.AccountIdList  = accountIdList;
                report.StatObjectType = StatObjctType.医生;
                report.ReportTitle    = "";
                report.Lister         = PublicDataReader.GetEmployeeNameById(currentEmployeeId);

                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;

                for (int i = 1; i < dgvReport.Columns.Count; i++)
                {
                    dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    dgvReport.Columns[i].Width = 80;
                }
                dgvReport.Columns[0].Frozen = true;
                dgvReport.Columns[1].Frozen = true;
                //第二部分
                ShowTotalInfo();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                Cursor           = Cursors.Default;
                btnStat.Enabled  = true;
                btnPrint.Enabled = true;
                btnClose.Enabled = true;
            }
        }
Ejemplo n.º 7
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime      beginDate;
            DateTime      endDate;
            BaseReport    report = null;
            string        accountIdList;
            StatDateType  dateType       = StatDateType.自然时间;
            StatClassType statType       = StatClassType.门诊发票分类;
            StatObjctType statObjectType = StatObjctType.医生;
            ReportStyle   style          = ReportStyle.科目为标题列;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString( ) == cboStatType.Text)
                {
                    statType = (StatClassType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(StatObjctType)))
            {
                if (obj.ToString( ) == cboType.Text)
                {
                    statObjectType = (StatObjctType)obj;
                    break;
                }
            }
            #endregion
            try
            {
                Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor( );
                SetButtonEnable(false);
                ReportController.GetReportBeginDateAndEndDate(dateType, 0, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
                lblDate.Text = beginDate.ToString("yyyy-MM-dd HH:mm:ss") + "  ——  " + endDate.ToString("yyyy-MM-dd HH:mm:ss");
                switch (statObjectType)
                {
                case StatObjctType.医生:
                    report = new DoctorIncomeReport( );
                    break;

                case StatObjctType.科室:
                    report = new DepartmentIncomeReport( );
                    break;

                case StatObjctType.收费员:
                    report = new TollerIncomeReport( );
                    break;

                case StatObjctType.病人类型:
                    report = new PatientTypeIncomReport( );
                    break;
                }
                report.BeginDate      = beginDate;
                report.EndDate        = endDate;
                report.StatType       = statType;
                report.Reportstyle    = style;
                report.StatDateType   = dateType;
                report.AccountIdList  = accountIdList;
                report.StatObjectType = statObjectType;
                report.ReportTitle    = "门诊" + cboType.Text + "收入报表";
                report.Lister         = PublicDataReader.GetEmployeeNameById(currentEmployeeId);

                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;

                for (int i = 1; i < dgvReport.Columns.Count; i++)
                {
                    dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                    dgvReport.Columns[i].Width = 80;
                }
                dgvReport.Columns[0].Frozen = true;
                dgvReport.Columns[1].Frozen = true;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetButtonEnable(true);
                Cursor = Cursors.Default;
            }
        }
Ejemplo n.º 8
0
        private void btnQuery_Click(object sender, EventArgs e)
        {
            TimeSpan span = dtpTo.Value - dtpFrom.Value;

            if ((span.Days + 1) > 7 && txtInvoiceNo.Text.Trim() == "" && txtPatient.Text.Trim() == "")
            {
                MessageBox.Show("没有指定病人姓名或者发票号的情况下,时间最大范围不能超过7天", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            try
            {
                string invoiceNo = txtInvoiceNo.Text.Trim();

                DataTable tbPres = PublicDataReader.Get_Prescriptions(txtPatient.Text, txtInvoiceNo.Text, dtpFrom.Value, dtpTo.Value);

                Hashtable htPrescription = new Hashtable( );

                for (int masterCount = 0; masterCount < tbPres.Rows.Count; masterCount++)
                {
                    //===========修改日期:2010-03-03 王志=============================
                    //=========================Begin===================================
                    //读取的医生站处方,在预算取消后,会形成垃圾数据,增加过滤条件,使
                    //这部分数据不显示出来
                    int chargFlag = Convert.ToInt32(tbPres.Rows[masterCount]["Charge_Flag"]);
                    int docPresId = Convert.ToInt32(tbPres.Rows[masterCount]["DocPresId"]);
                    if (chargFlag == 0 && docPresId != 0)
                    {
                        continue;
                    }
                    //=========================End======================================

                    int presMasterId = Convert.ToInt32(tbPres.Rows[masterCount]["PresMasterID"]);
                    if (htPrescription.ContainsKey(presMasterId))
                    {
                        continue;
                    }

                    Prescription prescription = new Prescription( );
                    #region 读取处方头
                    prescription.Charge_Flag    = Convert.ToInt32(tbPres.Rows[masterCount]["Charge_Flag"]);
                    prescription.Drug_Flag      = Convert.ToInt32(tbPres.Rows[masterCount]["Drug_Flag"]);
                    prescription.PrescriptionID = Convert.ToInt32(tbPres.Rows[masterCount]["PresMasterID"]);
                    prescription.PresDocCode    = tbPres.Rows[masterCount]["PresDocCode"].ToString().Trim();
                    prescription.Record_Flag    = Convert.ToInt32(tbPres.Rows[masterCount]["Record_Flag"]);
                    prescription.TicketNum      = tbPres.Rows[masterCount]["TicketNum"].ToString();
                    prescription.Total_Fee      = Convert.ToDecimal(tbPres.Rows[masterCount]["Pres_Total_Fee"]);
                    prescription.VisitNo        = tbPres.Rows[masterCount]["visitno"].ToString( ).Trim( );
                    prescription.PatientName    = tbPres.Rows[masterCount]["patname"].ToString( ).Trim( );
                    #endregion
                    DataRow[]            drs     = tbPres.Select("presmasterid=" + prescription.PrescriptionID, "order_flag asc");
                    PrescriptionDetail[] details = new PrescriptionDetail[drs.Length];
                    for (int orderCount = 0; orderCount < drs.Length; orderCount++)
                    {
                        #region 明细
                        details[orderCount]             = new PrescriptionDetail();
                        details[orderCount].Amount      = Convert.ToDecimal(drs[orderCount]["Amount"]);
                        details[orderCount].Itemname    = drs[orderCount]["ItemName"].ToString().Trim();
                        details[orderCount].Order_Flag  = Convert.ToInt32(drs[orderCount]["Order_Flag"]);
                        details[orderCount].PresAmount  = Convert.ToInt32(drs[orderCount]["PresAmount"]);
                        details[orderCount].RelationNum = Convert.ToDecimal(drs[orderCount]["RelationNum"]);
                        details[orderCount].Sell_price  = Convert.ToDecimal(drs[orderCount]["Sell_Price"]);
                        details[orderCount].Standard    = drs[orderCount]["Standard"].ToString( ).Trim( );
                        details[orderCount].Tolal_Fee   = Convert.ToDecimal(drs[orderCount]["Order_Total_Fee"]);
                        details[orderCount].Unit        = drs[orderCount]["Unit"].ToString( ).Trim( );
                        details[orderCount].Drug_Flag   = Convert.ToInt32(drs[orderCount]["Drug_Flag"]);
                        details[orderCount].BigitemCode = drs[orderCount]["Bigitemcode"].ToString( ).Trim( );
                        #endregion
                    }
                    prescription.PresDetails = details;
                    htPrescription.Add(presMasterId, prescription);
                }

                Prescription[] prescriptions = new Prescription[htPrescription.Count];
                int            index         = 0;
                foreach (object obj in htPrescription)
                {
                    prescriptions[index] = (Prescription)((DictionaryEntry)obj).Value;
                    index++;
                }


                ShowPrescriptions(prescriptions);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// 在填充空行前的约束检查
        /// 原则:
        /// 1、项目和药品不能在同一处方中
        /// 2、如果是项目,执行科室不同不能在同一处方中
        /// 3、西成药与中草药不能在同一处方中
        /// 4、在填充前检查选择的处方医生是否一致
        /// 5、处方医生是否填写
        /// 6、药品要进行0库存判断
        /// </summary>
        /// <param name="SelectedRow">将要填充的选择的行记录</param>
        /// <param name="rowIndex">要填充的行</param>
        /// <param name="message">返回的信息</param>
        /// <returns></returns>
        public bool ValidateRestrictBeforeFillSelectedRowData(DataRow SelectedRow, int rowIndex, out string message)
        {
            message = "";

            DataTable tbPresc = formView.Prescriptions;

            //处方明细空,允许
            if (tbPresc.Rows.Count == 0)
            {
                return(true);
            }

            string bigitemcode    = SelectedRow["STATITEM_CODE"].ToString( ).Trim( );
            string exec_dept_code = SelectedRow["EXEC_DEPT_CODE"].ToString( ).Trim( );

            //约束6:判断0库存
            if (bigitemcode == "01" || bigitemcode == "02" || bigitemcode == "03")
            {
                decimal sellprice, buyprice, storevalue;
                if (!PublicDataReader.StoreExists(Convert.ToInt32(SelectedRow["ITEM_ID"]), exec_dept_code, 0, out sellprice, out buyprice, out storevalue))
                {
                    message = "【" + SelectedRow["ITEM_NAME"].ToString().Trim() + "】库存为零。请通知药房及时入库";
                    return(false);
                }
            }

            int start, end, subtotalrow;

            GetPrescriptionSectionStartRow(rowIndex, out start, out end, out subtotalrow);

            if (rowIndex == start && start == end)
            {
                //是处方的第一行并且只有处方只有一个空行(新开的处方)
                if (formView.PrescDoctorId == 0)
                {
                    message = "没有选择处方医生!";
                    return(false);
                }
                return(true);
            }
            Hashtable doctorIds = new Hashtable( );

            for (int i = start; i <= end; i++)
            {
                if (i == rowIndex)
                {
                    continue;
                }
                int docId = Convert.ToInt32(tbPresc.Rows[i][COL_PRES_DOC_ID]);
                if (docId != 0)
                {
                    if (!doctorIds.ContainsKey(docId))
                    {
                        doctorIds.Add(docId, tbPresc.Rows[i][COL_PRES_DOC_NAME]);
                    }
                }

                if (Convert.ToInt32(tbPresc.Rows[i][COL_ITEM_ID]) != 0)
                {
                    string bigitemcode2    = tbPresc.Rows[i][COL_BIGITEMCODE].ToString( ).Trim( );
                    string exec_dept_code2 = tbPresc.Rows[i][COL_EXEC_DEPT_ID].ToString( ).Trim( );

                    bool selectedIsdrug = bigitemcode == "01" || bigitemcode == "02" || bigitemcode == "03";
                    bool detailIsdrug   = bigitemcode2 == "01" || bigitemcode2 == "02" || bigitemcode2 == "03";

                    #region 原则1、3判断
                    if (detailIsdrug && selectedIsdrug)
                    {
                        if (bigitemcode == "03" && (bigitemcode2 == "01" || bigitemcode2 == "02"))
                        {
                            message = "中草药与西药成药不能开在同一处方!";
                            return(false);
                        }
                        else
                        {
                            if (bigitemcode2 == "03" && (bigitemcode == "01" || bigitemcode == "02"))
                            {
                                message = "中草药与西药成药不能开在同一处方!";
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        if ((detailIsdrug && !selectedIsdrug) || (!detailIsdrug && selectedIsdrug))
                        {
                            message = "药品和项目不能开在同一处方!";
                            return(false);
                        }
                    }
                    #endregion

                    #region 原则2判断
                    if (!selectedIsdrug && !detailIsdrug)
                    {
                        if (exec_dept_code2 != exec_dept_code)
                        {
                            message = "项目的执行科室不同不能开在同一处方!";
                            return(false);
                        }
                    }
                    #endregion
                }
            }
            //验证4约束
            if (doctorIds.Count > 0 && !doctorIds.ContainsKey(formView.PrescDoctorId))
            {
                message = "当前的处方医生不是指定的医生,同一处方只允许一个医生";
                return(false);
            }
            return(true);
        }
Ejemplo n.º 10
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            SetControlEnable(false);
            DateTime     beginDate;
            DateTime     endDate;
            BaseReport   report = null;
            string       accountIdList;
            string       patTypeCode = "";
            StatDateType dateType    = StatDateType.自然时间;
            OPDBillKind  invoiceType = OPDBillKind.所有发票;

            #region 统计条件
            #endregion
            if (chkIsUseTime.Checked)
            {
                ReportController.GetReportBeginDateAndEndDate(dateType, 0, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
            }
            else
            {
                ReportController.GetReportBeginDateAndEndDate(dateType, 0, new DateTime(1, 1, 1), new DateTime(9999, 12, 30),
                                                              out beginDate, out endDate, out accountIdList);
            }
            lblDate.Text = beginDate.ToString("yyyy-MM-dd HH:mm:ss") + "--" + endDate.ToString("yyyy-MM-dd HH:mm:ss");
            try
            {
                report = new PatientFeeReport( );
                ((PatientFeeReport)report).PatName = txtPatName.Text;
                ((PatientFeeReport)report).VisitNo = txtVisitNo.Text;
                report.BeginDate = beginDate;
                report.EndDate   = endDate;
                ((PatientFeeReport)report).PatientTypeCode = patTypeCode;
                ((PatientFeeReport)report).InvoiceType     = invoiceType;
                report.StatDateType  = dateType;
                report.AccountIdList = accountIdList;
                report.ReportTitle   = "门诊病人费用统计表";
                report.Lister        = PublicDataReader.GetEmployeeNameById(employeeId);
                ReportController.FillReport(report);
                dgvReport.DataSource = report.DataResult;
                dgvReport.Tag        = report;
                for (int i = 0; i < dgvReport.Columns.Count; i++)
                {
                    if (i >= 3)
                    {
                        dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvReport.Columns[i].Width = 80;
                    }
                    if (i < 4)
                    {
                        dgvReport.Columns[i].Frozen = true;
                    }
                }
            }
            catch
            {
                MessageBox.Show("统计发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetControlEnable(true);
            }
        }
Ejemplo n.º 11
0
        private void txtInvoiceNo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((int)e.KeyChar == 13)
            {
                if (txtInvoiceNo.Text.Trim( ) == "")
                {
                    MessageBox.Show("请输入要退费的发票号", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                else
                {
                    try
                    {
                        string invoiceNo = Convert.ToInt32(txtInvoiceNo.Text).ToString();

                        txtInvoiceNo.Text = HIS.MZ_BLL.InvoiceManager.FormatInvoiceNo(invoiceNo);

                        currentPatient = new HIS.MZ_BLL.OutPatient(invoiceNo, OPDBillKind.门诊收费发票);

                        txtPatientName.Text = currentPatient.PatientName;
                        //lblFeeType.Text = PublicDataReader.GetPatientTypeNameByCode( currentPatient.MediType );
                        lblFeeType.Text = BaseDataController.GetName(BaseDataCatalog.病人类型列表, currentPatient.MediType);

                        currentInvoice = new HIS.MZ_BLL.Invoice(txtPerfChar.Text.Trim(), invoiceNo, OPDBillKind.门诊收费发票);
                        if (currentInvoice.RecordFlag != 0)
                        {
                            MessageBox.Show("该发票已经退费,请确认输入的发票号是否正确!");
                            txtInvoiceNo.Focus();
                            return;
                        }
                        lstRetYP = PublicDataReader.GetDrugReturnValueList(currentInvoice.InvoiceNo);

                        ShowPrescriptions(currentInvoice.Prescription, lstRetYP);
                        lblInvoiceNo.Text = currentInvoice.PerfChar + txtInvoiceNo.Text;
                        lblTotal.Text     = currentInvoice.TotalPay.ToString("0.00");
                        lblCash.Text      = currentInvoice.CashPay.ToString("0.00");
                        lblPOS.Text       = currentInvoice.PosPay.ToString("0.00");
                        lblChargeUp.Text  = currentInvoice.VillagePay.ToString("0.00");
                        lblFover.Text     = currentInvoice.FavorPay.ToString("0.00");
                        lblSelfTally.Text = currentInvoice.SelfTally.ToString("0.00");

                        //
                        if (Convert.ToInt32(HIS.MZ_BLL.OPDParamter.Parameters["016"]) == 0)
                        {
                            btnAll.Enabled    = false;
                            dgvPresc.ReadOnly = true;
                            btnAll_Click(null, null);
                            return;
                        }
                    }
                    catch (Exception err)
                    {
                        MessageBox.Show(err.Message + "\r\n1、确认发票号是否输入正确。\r\n2、确认是否输入了发票前缀字母。", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtInvoiceNo.Focus();
                        txtInvoiceNo.Text   = "";
                        txtPatientName.Text = "";
                        lblFeeType.Text     = "";
                        dgvPresc.Rows.Clear();
                        lblCash.Text     = "0.00";
                        lblChargeUp.Text = "0.00";
                        lblFover.Text    = "0.00";
                        lblPOS.Text      = "0.00";
                        lblTotal.Text    = "0.00";
                    }

                    //add zenghao
                    this.btnAll.Enabled = true;
                    dgvPresc.Focus( );
                }
            }
        }