Esempio n. 1
0
        /// <summary>
        /// 获取指定的表字段
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public List <string> GetSystemFieldList(string TableName)
        {
            //string dllName = System.Windows.Forms.Application.StartupPath + "\\HIS.Entity.dll";
            //Assembly assembly = Assembly.LoadFile( dllName );
            //string typeName = "HIS.Model." + TableName;
            //object obj = assembly.CreateInstance( typeName, true );
            //List<string> lstField = new List<string>();
            //if ( obj != null )
            //{
            //    PropertyInfo[] properies = obj.GetType().GetProperties();
            //    for ( int i = 0; i < properies.Length; i++ )
            //    {
            //        lstField.Add( properies[i].Name );
            //    }
            //}
            //return lstField;
            DataRow[]     drsFields = BaseDataController.GetTableColumn().Select("TBNAME='" + TableName + "'");
            List <string> lstField  = new List <string>();

            foreach (DataRow dr in drsFields)
            {
                lstField.Add(dr["NAME"].ToString().Trim());
            }
            return(lstField);
        }
Esempio n. 2
0
 protected void Awake()
 {
     controllerForGameConfig = new GameConfigController(this, this);
     controllerForChunkSave  = new ChunkSaveController(this, this);
     controllerForUserData   = new UserDataController(this, this);
     controllerForBase       = new BaseDataController(this, this);
     controllerForGameConfig.GetGameConfigData();
 }
        /// <summary>
        /// 删除一条记录
        /// </summary>
        public void DeleteBaseDataRecord()
        {
            BaseDataRecord objRecord = CreateRecordInstance();

            if (objRecord != null)
            {
                string tableName = formView.SelectedTable.BASE_TABLE_DB_NAME.ToString().Trim();
                BaseDataController.DeleteBaseDataRecord(objRecord, formView.SelectedTable);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 测试SQL是否正确
 /// </summary>
 /// <returns></returns>
 public bool TestSQL()
 {
     try
     {
         BaseDataController.GetDataTable(this.cboForignerTable.Text.Trim(),
                                         new string[] { this.cboForignerID_Field.Text.Trim(), this.cboForignerName_Field.Text.Trim() },
                                         this.txtFilterSql.Text.Trim());
         return(true);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
 /// <summary>
 /// 测试SQL是否正确
 /// </summary>
 /// <returns></returns>
 public bool TestSQL()
 {
     try
     {
         BaseDataController.GetDataTable(formView.FOREIGNER_TABLE,
                                         new string[] { formView.FOREIGNER_FIELD_DB_NAME, formView.FOREIGNER_FIELD_CN_NAME },
                                         formView.FOREIGNER_FILTER_SQL);
         return(true);
     }
     catch (Exception err)
     {
         throw err;
     }
 }
        /// <summary>
        /// 初始化控制器
        /// </summary>
        public void Initiazle()
        {
            systemTables = BaseDataController.GetSystemTableList();
            DataTable tbbaseTable = BaseDataReader.GetVindicateTableList();

            vindicateTableList = new List <TableConfig>();
            for (int i = 0; i < tbbaseTable.Rows.Count; i++)
            {
                TableConfig tableConfig = new TableConfig();
                tableConfig.BASE_TABLE_CN_NAME  = tbbaseTable.Rows[i][Tables.base_vindicate_table.BASE_TABLE_CN_NAME].ToString().Trim();
                tableConfig.BASE_TABLE_DB_NAME  = tbbaseTable.Rows[i][Tables.base_vindicate_table.BASE_TABLE_DB_NAME].ToString().Trim();
                tableConfig.ALLOW_USER_EDIT     = Convert.ToInt32(tbbaseTable.Rows[i][Tables.base_vindicate_table.ALLOW_USER_EDIT]) == 1 ? true : false;
                tableConfig.ALLOW_PHYSIC_DELETE = Convert.ToInt32(tbbaseTable.Rows[i][Tables.base_vindicate_table.ALLOW_PHYSIC_DELETE]) == 1 ? true : false;
                vindicateTableList.Add(tableConfig);
            }
        }
        /// <summary>
        /// 加载数据
        /// </summary>
        public void Initalize()
        {
            tbSystemTable = BaseDataController.GetSystemTableList();
            //加载字段配置表
            tbFieldConfig = GetVindicateTableFieldList();
            ////根据表名从DLL加载字段列表
            //string dllName = System.Windows.Forms.Application.StartupPath + "\\HIS.Entity.dll";
            //Assembly assembly = Assembly.LoadFile( dllName );
            //string typeName = "HIS.Model." + tableInfo.BASE_TABLE_DB_NAME.ToString().Trim();
            //object obj = assembly.CreateInstance( typeName, true );
            //if ( obj == null )
            //    throw new Exception( "未能从实体文件加载表对象【"+typeName + "】");
            //PropertyInfo[] properies = obj.GetType().GetProperties();
            //获取当前数据库表
            DataTable tb = BaseDataReader.GetBaseTableData(tableInfo.BASE_TABLE_DB_NAME.ToString(), "1>2");

            lstField = new List <Item>();
            bool reloadConfig = false;

            for (int i = 0; i < tb.Columns.Count; i++)
            {
                string strWhere = Tables.base_table_config.TABLE_DB_NAME + " = '" + tableInfo.BASE_TABLE_DB_NAME.ToString().Trim() + "' and "
                                  + Tables.base_table_config.FIELD_DB_NAME + " = '" + tb.Columns[i].ColumnName + "'";
                DataRow[] drsFields = tbFieldConfig.Select(strWhere);
                if (drsFields.Length == 0)
                {
                    TableAndFieldConfig.AddDefaultConfig(tableInfo, tb.Columns[i].ColumnName);
                    reloadConfig = true;
                }
            }
            if (reloadConfig)
            {
                tbFieldConfig = GetVindicateTableFieldList();
            }
            for (int i = 0; i < tbFieldConfig.Rows.Count; i++)
            {
                Item item = new Item();
                item.Text  = tbFieldConfig.Rows[i][Tables.base_table_config.FIELD_CN_NAME].ToString().Trim();
                item.Value = tbFieldConfig.Rows[i][Tables.base_table_config.FIELD_DB_NAME].ToString().Trim();
                lstField.Add(item);
            }
        }
Esempio n. 8
0
        public static UIOutPatient ConvertPatient(OutPatient p)
        {
            string       name = "";
            UIOutPatient pat  = new UIOutPatient( );
            Age          age  = new Age( );

            age.AgeNum = p.Age;
            foreach (object obj in Enum.GetValues(typeof(AgeUnit)))
            {
                if (obj.ToString( ) == p.HpGrade)
                {
                    age.Unit = (AgeUnit)obj;
                    break;
                }
            }
            pat.BordDay = XcDate.AgeToDate(age);
            pat.CardNo  = p.HisCardNo;
            //name = PublicDataReader.GetDeptNameById( Convert.ToInt32( p.CureDeptCode == "" ? "0" : p.CureDeptCode ) );
            name = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(p.CureDeptCode == "" ? "0" : p.CureDeptCode));
            pat.CureDepartment = new BindValue(p.CureDeptCode, name);

            //name = PublicDataReader.GetEmployeeNameById( Convert.ToInt32( p.CureEmpCode == "" ? "0" : p.CureEmpCode ) );
            name           = BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(p.CureEmpCode == "" ? "0" : p.CureEmpCode));
            pat.CureDoctor = new BindValue(p.CureEmpCode, name);

            pat.Disease      = new BindValue(p.DiseaseCode, p.DiseaseName);
            pat.OutPatientNo = p.VisitNo;
            pat.PatId        = Convert.ToInt32(p.PatID);
            pat.PatientName  = p.PatientName;
            //pat.PatientType = new BindValue( p.MediType , PublicDataReader.GetPatientTypeNameByCode( p.MediType ) );
            pat.PatientType   = new BindValue(p.MediType, BaseDataController.GetName(BaseDataCatalog.病人类型列表, p.MediType));
            pat.PatListId     = p.PatListID;
            pat.RegDate       = p.CureDate;
            pat.RegDepartment = pat.CureDepartment;
            pat.Sex           = p.Sex;

            pat.WorkUnit = new BindValue(p.HpCode, GetWorkUnitNameByCode(p.HpCode));



            return(pat);
        }
Esempio n. 9
0
        private void FrmCreatePYWB_Load(object sender, EventArgs e)
        {
            tbColumns = BaseDataController.GetTableColumn( );
            DataTable tbTables = new DataTable( );

            tbTables.Columns.Add("TBNAME");
            for (int i = 0; i < tbColumns.Rows.Count; i++)
            {
                string tbName = tbColumns.Rows[i]["TBNAME"].ToString( ).Trim( );
                if (tbTables.Select("TBNAME='" + tbName + "'").Length == 0)
                {
                    tbTables.Rows.Add(tbName);
                }
            }
            cboTable.DisplayMember         = "TBNAME";
            cboTable.ValueMember           = "TBNAME";
            cboTable.DataSource            = tbTables;
            cboTable.SelectedIndex         = -1;
            cboTable.SelectedIndexChanged += new EventHandler(cboTable_SelectedIndexChanged);
        }
Esempio n. 10
0
 private void ShowPatientList(List <BasePatient> lstPatient)
 {
     dgvPatList.Rows.Clear( );
     foreach (BasePatient p in lstPatient)
     {
         OutPatient patient = (OutPatient)p;
         int        row     = dgvPatList.Rows.Add( );
         dgvPatList[COL_PATLISTID.Name, row].Value = patient.PatListID;
         dgvPatList[COL_VISITNO.Name, row].Value   = patient.VisitNo;
         dgvPatList[COL_PATNAME.Name, row].Value   = patient.PatientName;
         dgvPatList[COL_SEX.Name, row].Value       = patient.Sex;
         dgvPatList[COL_AGE.Name, row].Value       = patient.Age;
         dgvPatList[COL_PATTYPE.Name, row].Value   = BaseDataController.GetName(BaseDataCatalog.病人类型列表, patient.MediType.Trim());                                                //PublicDataReader.GetPatientTypeNameByCode( patient.MediType.Trim());
         dgvPatList[COL_DOCTOR.Name, row].Value    = BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(patient.CureEmpCode == "" ? "0" : patient.CureEmpCode));   //PublicDataReader.GetEmployeeNameById( Convert.ToInt32( patient.CureEmpCode == "" ? "0" : patient.CureEmpCode ) );
         dgvPatList[COL_DEPT.Name, row].Value      = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(patient.CureDeptCode == "" ? "0" : patient.CureDeptCode)); //PublicDataReader.GetDeptNameById( Convert.ToInt32( patient.CureDeptCode == "" ? "0" : patient.CureDeptCode ) );
         dgvPatList[COL_CURDATE.Name, row].Value   = patient.CureDate;
         dgvPatList.Rows[row].Tag = patient;
     }
     dgvPatList.CurrentCell = null;
 }
Esempio 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( );
                }
            }
        }
Esempio n. 12
0
 static GameCommonInfo()
 {
     baseDataController = new BaseDataController(null, null);
     baseDataController.InitBaseData();
     SpriteAtlasManager.atlasRequested += RequestAtlas;
 }
Esempio n. 13
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime   beginDate;
            DateTime   endDate;
            BaseReport report = null;
            string     accountIdList;

            StatDateType  dateType = StatDateType.自定义时间;
            StatClassType statType = StatClassType.门诊发票分类;
            ReportStyle   style    = ReportStyle.科目为标题列;

            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString() == cboStatType.Text)
                {
                    statType = (StatClassType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(ReportStyle)))
            {
                if (obj.ToString() == cboStyle.Text)
                {
                    style = (ReportStyle)obj;
                    break;
                }
            }
            StatObjctType statObjectType = StatObjctType.收费员;

            try
            {
                Cursor = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.WaitCursor();
                ReportController.GetReportBeginDateAndEndDate(dateType, 15, dtpFrom.Value, dtpEnd.Value, out beginDate, out endDate, out accountIdList);
                report           = new TollerIncomeReport();
                report.BeginDate = dtpFrom.Value;
                report.EndDate   = dtpEnd.Value;

                report.StatType     = statType;
                report.Reportstyle  = style;
                report.StatDateType = dateType;
                // report.AccountIdList = accountIdList;
                report.StatObjectType = statObjectType;
                report.ReportTitle    = "门诊收费员工作量统计报表";

                report.Lister = BaseDataController.GetName(BaseDataCatalog.人员列表, currentEmployeeId);
                ReportController.FillReport(report, dtpFrom.Value, dtpEnd.Value);
                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 (OperatorException oe)
            {
                MessageBox.Show(oe.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                MessageBox.Show("统计报表中发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
Esempio n. 14
0
        private void btnCreat_Click(object sender, EventArgs e)
        {
            if (!chkPY.Checked && !chkWB.Checked)
            {
                MessageBox.Show("必须指定一个生成内容!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (cboTable.Text == "" || cboName.Text == "" || cboPK.Text == "" || cboPY.Text.Trim( ) == "" || cboWb.Text.Trim( ) == "")
            {
                MessageBox.Show("字段信息选择不完整!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            try
            {
                SetControlEnable(false);
                isProcess = true;
                DataTable tbData    = BaseDataReader.GetBaseTableData(cboTable.Text, "");
                string    nameField = cboName.Text;
                string    pyField   = cboPY.Text;
                string    wbField   = cboWb.Text;

                pgbCount.Maximum = tbData.Rows.Count;
                pgbCount.Value   = 1;

                ColumnInfo nameColumn = new ColumnInfo();
                nameColumn.ColumnName = nameField;

                ColumnInfo keyColumn = new ColumnInfo();
                keyColumn.ColumnName = cboPK.Text;
                keyColumn.IsNumeric  = chkIsNumeric.Checked;

                ColumnInfo pyColumn = null;
                if (chkPY.Checked)
                {
                    pyColumn            = new ColumnInfo( );
                    pyColumn.ColumnName = cboPY.Text;
                }
                ColumnInfo wbColumn = null;
                if (chkWB.Checked)
                {
                    wbColumn            = new ColumnInfo( );
                    wbColumn.ColumnName = cboWb.Text;
                }

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    Application.DoEvents( );
                    lblCount.Text        = tbData.Rows.Count.ToString( ) + "/" + i.ToString( );
                    nameColumn.DataValue = tbData.Rows[i][nameField].ToString( ).Trim( );
                    keyColumn.DataValue  = tbData.Rows[i][keyColumn.ColumnName].ToString( ).Trim( );
                    string currentPy = Convert.IsDBNull(tbData.Rows[i][cboPY.Text]) ? "" : tbData.Rows[i][cboPY.Text].ToString( ).Trim( );
                    string currentWb = Convert.IsDBNull(tbData.Rows[i][cboWb.Text]) ? "" : tbData.Rows[i][cboWb.Text].ToString( ).Trim( );
                    if (currentPy != "" && currentWb != "")
                    {
                        pgbCount.Value = i + 1;
                        continue;
                    }
                    string[] pywb = GWMHIS.BussinessLogicLayer.Classes.PublicStaticFun.GetPyWbCode(nameColumn.DataValue.ToString());
                    if (pyColumn != null)
                    {
                        if (chkEmpty.Checked && currentPy != "")
                        {
                            pyColumn.DataValue = null;
                        }
                        else
                        {
                            pyColumn.DataValue = pywb[0];
                        }
                    }
                    if (wbColumn != null)
                    {
                        if (chkEmpty.Checked && currentWb != "")
                        {
                            wbColumn.DataValue = null;
                        }
                        else
                        {
                            wbColumn.DataValue = pywb[1];
                        }
                    }

                    BaseDataController.UpdatePYWBField(cboTable.Text, nameColumn, keyColumn, pyColumn, wbColumn);
                    pgbCount.Value++;
                }
                pgbCount.Value = pgbCount.Maximum;
                MessageBox.Show("生成完成!");
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                isProcess = false;
                SetControlEnable(true);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 显示处方
        /// </summary>
        /// <param name="Prescriptions"></param>
        private void ShowPrescriptions(Prescription[] Prescriptions)
        {
            dgvPresc.Rows.Clear( );
            for (int i = 0; i < Prescriptions.Length; i++)
            {
                Color bkColor = Color.White;
                if (i % 2 == 0)
                {
                    bkColor = Color.WhiteSmoke;
                }
                decimal presSubTotal = 0;
                Color   forceColor   = Color.Blue;
                if (Prescriptions[i].Record_Flag != 0)
                {
                    forceColor = Color.Red;
                }

                for (int j = 0; j < Prescriptions[i].PresDetails.Length; j++)
                {
                    dgvPresc.Rows.Add( );
                    int row = dgvPresc.Rows.Count - 1;
                    dgvPresc["PresID", row].Value = Prescriptions[i].PrescriptionID;
                    if (j == 0)
                    {
                        dgvPresc["NO", row].Value = Convert.ToString(i + 1);
                        //dgvPresc["PresID" , row].Value = Prescriptions[i].PrescriptionID;
                        dgvPresc["InvoiceNo", row].Value = Prescriptions[i].TicketNum;
                        dgvPresc["PatName", row].Value   = Prescriptions[i].PatientName;
                        dgvPresc["VisitNo", row].Value   = Prescriptions[i].VisitNo;
                        //dgvPresc[DoctorName.Name , row].Value = Prescriptions[i].PresDocCode.Trim( ) == "" ? "" : PublicDataReader.GetEmployeeNameById( Convert.ToInt32( Prescriptions[i].PresDocCode ) );
                        dgvPresc[DoctorName.Name, row].Value = Prescriptions[i].PresDocCode.Trim() == "" ? "" : BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(Prescriptions[i].PresDocCode));
                    }
                    dgvPresc["Item_Name", row].Value = Prescriptions[i].PresDetails[j].Itemname;
                    dgvPresc["Standard", row].Value  = Prescriptions[i].PresDetails[j].Standard;
                    dgvPresc["Price", row].Value     = Prescriptions[i].PresDetails[j].Sell_price;
                    dgvPresc["PACK_Unit", row].Value = Prescriptions[i].PresDetails[j].Unit;
                    if (Prescriptions[i].PresDetails[j].BigitemCode == "01" ||
                        Prescriptions[i].PresDetails[j].BigitemCode == "02" ||
                        Prescriptions[i].PresDetails[j].BigitemCode == "03")
                    {
                        decimal baseNum = Prescriptions[i].PresDetails[j].Amount % Prescriptions[i].PresDetails[j].RelationNum;
                        decimal packNum = (Prescriptions[i].PresDetails[j].Amount - baseNum) / Prescriptions[i].PresDetails[j].RelationNum;

                        dgvPresc["PACK_NUM", row].Value = packNum;
                        dgvPresc["BASE_NUM", row].Value = baseNum;
                    }
                    else
                    {
                        dgvPresc["PACK_NUM", row].Value = 0;
                        dgvPresc["BASE_NUM", row].Value = Prescriptions[i].PresDetails[j].Amount;
                    }

                    dgvPresc["PresAmount", row].Value = Prescriptions[i].PresDetails[j].PresAmount;
                    dgvPresc["TotalCost", row].Value  = Prescriptions[i].PresDetails[j].Tolal_Fee;
                    presSubTotal += Prescriptions[i].PresDetails[j].Tolal_Fee;

                    //if ( Prescriptions[i].Record_Flag == 0 )
                    //{
                    if (Prescriptions[i].Charge_Flag != 0)
                    {
                        dgvPresc["RECORD_FLAG", row].Value = "√";
                    }
                    else
                    {
                        dgvPresc["RECORD_FLAG", row].Value = "";
                    }
                    //}
                    //else
                    //{
                    //    dgvPresc["RECORD_FLAG", row].Value = ""; //退费的用红字显示
                    //}
                    if (Prescriptions[i].PresDetails[j].BigitemCode == "01" ||
                        Prescriptions[i].PresDetails[j].BigitemCode == "02" ||
                        Prescriptions[i].PresDetails[j].BigitemCode == "03")
                    {
                        if (Prescriptions[i].Drug_Flag == 1)
                        {
                            dgvPresc["Drug_Flag", row].Value = "√";
                        }
                        else
                        {
                            dgvPresc["Drug_Flag", row].Value = "";
                        }
                    }
                    //颜色
                    for (int r = 0; r < dgvPresc.Columns.Count; r++)
                    {
                        dgvPresc.Rows[row].Cells[r].Style.ForeColor = forceColor;
                        dgvPresc.Rows[row].Cells[r].Style.BackColor = bkColor;
                    }
                }
                //小计
                dgvPresc.Rows.Add( );
                dgvPresc["Standard", dgvPresc.Rows.Count - 1].Value = "小    计:";
                Hashtable htBigItem;
                decimal   roundMoney;
                //presSubTotal = BaseDataController.CalculatePrescriptionTotalFee( Prescriptions[i] , out htBigItem , out roundMoney );
                List <IPresDetail> lstDetail = new List <IPresDetail>();
                for (int detailIndex = 0; detailIndex < Prescriptions[i].PresDetails.Length; detailIndex++)
                {
                    lstDetail.Add(Prescriptions[i].PresDetails[detailIndex]);
                }



                presSubTotal = (new PrescMoneyCalculate()).GetPrescriptionTotalMoney(lstDetail, out htBigItem, out roundMoney);

                dgvPresc["TotalCost", dgvPresc.Rows.Count - 1].Value = Decimal.Round(presSubTotal, 1);
                for (int m = 0; m < dgvPresc.Columns.Count; m++)
                {
                    dgvPresc[m, dgvPresc.Rows.Count - 1].Style.ForeColor = forceColor;
                    dgvPresc[m, dgvPresc.Rows.Count - 1].Style.BackColor = bkColor;
                    dgvPresc[m, dgvPresc.Rows.Count - 1].ReadOnly        = true;
                }
            }
        }
Esempio n. 16
0
        private void FormatData(DataTable tbData)
        {
            DataTable tbResult = new DataTable( );

            tbResult.Columns.Add("统计项目", Type.GetType("System.String"));
            tbResult.Columns.Add("合计", Type.GetType("System.Decimal"));
            for (int i = 0; i < tbData.Rows.Count; i++)
            {
                //string deptId = PublicDataReader.GetDeptNameById( Convert.ToInt32( tbData.Rows[i]["ID"] )) ;
                string deptId = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(tbData.Rows[i]["ID"]));
                if (!tbResult.Columns.Contains(deptId))
                {
                    DataColumn col = new DataColumn(deptId, Type.GetType("System.Decimal"));
                    //col.Caption = PublicDataReader.GetDeptNameById( Convert.ToInt32( tbData.Rows[i]["ID"] ) );
                    col.Caption = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(tbData.Rows[i]["ID"]));
                    tbResult.Columns.Add(col);
                }
            }

            for (int i = 0; i < tbData.Rows.Count; i++)
            {
                //string deptId = PublicDataReader.GetDeptNameById( Convert.ToInt32( tbData.Rows[i]["ID"] ) );
                string  deptId    = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(tbData.Rows[i]["ID"]));
                string  code      = tbData.Rows[i]["CODE"].ToString( ).Trim( );
                decimal total_fee = Convert.ToDecimal(tbData.Rows[i]["Total_Fee"]);

                if (tbResult.Select("统计项目='" + code + "'").Length == 0)
                {
                    DataRow drNew = tbResult.NewRow( );
                    drNew["统计项目"] = code;
                    drNew[deptId] = total_fee;
                    drNew["合计"]   = total_fee;
                    tbResult.Rows.Add(drNew);
                }
                else
                {
                    DataRow[] drs = tbResult.Select("统计项目='" + code + "'");
                    decimal   fee = Convert.IsDBNull(drs[0][deptId]) ? 0 : Convert.ToDecimal(drs[0]["total_fee"]);
                    drs[0][deptId] = total_fee + fee;
                    drs[0]["合计"]   = Convert.ToDecimal(drs[0]["合计"]) + Convert.ToDecimal(drs[0][deptId]);
                }
            }

            for (int i = 0; i < tbResult.Rows.Count; i++)
            {
                //DataRow[] drs = PublicDataReader.StatItemList.Select( "STAT_CODE='" + tbResult.Rows[i]["统计项目"].ToString( ).Trim( ) + "'" );
                DataRow[] drs       = BaseDataController.BaseDataSet[BaseDataCatalog.基本分类与各分类对应表].Select("STAT_CODE='" + tbResult.Rows[i]["统计项目"].ToString().Trim() + "'");
                string    item_name = drs[0]["STAT_NAME"].ToString().Trim();
                tbResult.Rows[i]["统计项目"] = item_name;
            }

            DataRow drTotal = tbResult.NewRow( );

            drTotal["统计项目"] = "合计";

            for (int i = 0; i < tbResult.Columns.Count; i++)
            {
                if (tbResult.Columns[i].ColumnName == "统计项目")
                {
                    continue;
                }

                string fieldname = tbResult.Columns[i].ColumnName;
                object obj       = tbResult.Compute("SUM(" + fieldname + ")", "");
                if (obj != null && !Convert.IsDBNull(obj))
                {
                    drTotal[fieldname] = obj;
                }
            }
            tbResult.Rows.Add(drTotal);

            dgvStatItem.DataSource = tbResult;

            for (int i = 1; i < dgvStatItem.Columns.Count; i++)
            {
                dgvStatItem.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            }
            dgvStatItem.Columns[1].Frozen = true;

            for (int i = 0; i < tbData.Rows.Count; i++)
            {
                //DataRow[] drs = PublicDataReader.StatItemList.Select( "STAT_CODE='" + tbData.Rows[i]["CODE"].ToString( ).Trim( ) + "'" );
                DataRow[] drs       = BaseDataController.BaseDataSet[BaseDataCatalog.基本分类与各分类对应表].Select("STAT_CODE='" + tbData.Rows[i]["CODE"].ToString().Trim() + "'");
                string    item_name = drs[0]["STAT_NAME"].ToString( ).Trim( );
                //string dept_name = PublicDataReader.GetDeptNameById( Convert.ToInt32( tbData.Rows[i]["ID"] ) );
                string dept_name = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(tbData.Rows[i]["ID"]));
                tbData.Rows[i]["ID"]   = dept_name;
                tbData.Rows[i]["CODE"] = item_name;
            }
            dgvStatItem.Tag = tbData;
        }
Esempio n. 17
0
        /// <summary>
        /// 填充选择卡选中行的数据到指定的行
        /// </summary>
        /// <param name="SelectedRow">从选项卡选择的行记录</param>
        /// <param name="rowIndex">当前要填充的行</param>
        private void _fillSelectedRowData(DataRow SelectedRow, int rowIndex)
        {
            DataTable tbPresc = (DataTable)formView.Prescriptions;
            DataRow   dr      = tbPresc.Rows[rowIndex];

            dr[COL_KEYWORD]       = SelectedRow["CODE"].ToString( ).Trim( );
            dr[COL_ITEM_NAME]     = SelectedRow["CHEM_NAME"].ToString( ).Trim( );
            dr[COL_ITEM_UNIT]     = SelectedRow["ITEM_UNIT"].ToString( ).Trim( );
            dr[COL_STANDARD]      = SelectedRow["STANDARD"].ToString( ).Trim( );
            dr[COL_SELL_PRICE]    = Convert.ToDecimal(SelectedRow["PRICE"]);
            dr[COL_PACK_NUM]      = 0;
            dr[COL_PACK_UNIT]     = SelectedRow["ITEM_UNIT"].ToString( ).Trim( );
            dr[COL_BASE_NUM]      = 0;
            dr[COL_BASE_UNIT]     = SelectedRow["BASE_UNIT"].ToString( ).Trim( );
            dr[COL_PRES_DOSAGE]   = 1;
            dr[COL_PRES_DOC_NAME] = BaseDataController.GetName(BaseDataCatalog.人员列表, formView.PrescDoctorId);
            dr[COL_PRESDETAIL_ID] = 0;

            dr[COL_TOTAL_FEE]     = 0;
            dr[COL_SELECTED_FLAG] = true;
            dr[COL_PRESC_TYPE]    = "";
            dr[COL_ITEM_ID]       = Convert.ToInt32(SelectedRow["ITEM_ID"]);
            dr[COL_COMPLEX_ID]    = Convert.ToInt32(SelectedRow["COMPLEX_ID"]);
            dr[COL_BUY_PRICE]     = dr[COL_SELL_PRICE];
            dr[COL_RELATION_NUM]  = Convert.ToDecimal(SelectedRow["HJXS"]);
            //查找当前行所在的处方的医生、处方ID,
            #region .................
            int start, end, subTotalRow;
            GetPrescriptionSectionStartRow(rowIndex, out start, out end, out subTotalRow);
            if (subTotalRow == -1)
            {
                if (start == end)
                {
                    //如果是新开处方的第一行,处方医生和科室取当前选择的医生和科室
                    dr[COL_PRES_DOC_ID]   = formView.PrescDoctorId;
                    dr[COL_PRES_DEPT_ID]  = formView.DoctorDeptId;
                    dr[COL_PRESMASTER_ID] = 0;
                }
                else
                {
                    //取其他行的医生和科室
                    for (int i = start; i <= end; i++)
                    {
                        if (!Convert.IsDBNull(tbPresc.Rows[i][COL_PRES_DOC_ID]) &&
                            tbPresc.Rows[i][COL_PRES_DOC_ID].ToString( ).Trim( ) != "")
                        {
                            dr[COL_PRES_DOC_ID]   = tbPresc.Rows[i][COL_PRES_DOC_ID];
                            dr[COL_PRES_DEPT_ID]  = tbPresc.Rows[i][COL_PRES_DEPT_ID];
                            dr[COL_PRESMASTER_ID] = tbPresc.Rows[i][COL_PRESMASTER_ID];

                            break;
                        }
                    }
                }
            }
            else
            {
                //取其他行的医生和科室
                for (int i = start; i <= end; i++)
                {
                    if (!Convert.IsDBNull(tbPresc.Rows[i][COL_PRES_DOC_ID]) &&
                        tbPresc.Rows[i][COL_PRES_DOC_ID].ToString( ).Trim( ) != "")
                    {
                        dr[COL_PRES_DOC_ID]   = tbPresc.Rows[i][COL_PRES_DOC_ID];
                        dr[COL_PRES_DEPT_ID]  = tbPresc.Rows[i][COL_PRES_DEPT_ID];
                        dr[COL_PRESMASTER_ID] = tbPresc.Rows[i][COL_PRESMASTER_ID];
                        break;
                    }
                }
            }
            #endregion
            if (SelectedRow["EXEC_DEPT_CODE"].ToString() == "0")
            {
                //dr[COL_EXEC_DEPT_NAME] = PublicDataReader.GetDeptNameById(formView.DoctorDeptId);
                dr[COL_EXEC_DEPT_NAME] = BaseDataController.GetName(BaseDataCatalog.科室列表, formView.DoctorDeptId);
                dr[COL_EXEC_DEPT_ID]   = formView.DoctorDeptId;
            }
            else
            {
                dr[COL_EXEC_DEPT_NAME] = SelectedRow["EXEC_DEPT_NAME"].ToString().Trim();
                dr[COL_EXEC_DEPT_ID]   = SelectedRow["EXEC_DEPT_CODE"].ToString().Trim();
            }
            dr[COL_DOC_PRESMASTER_ID] = 0;
            dr[COL_DOC_PRESDETAIL_ID] = 0;
            dr[COL_BIGITEMCODE]       = SelectedRow["STATITEM_CODE"].ToString( ).Trim( );
            dr[COL_MODIFY_FLAG]       = 1;
            dr[COL_SUB_TOTAL_FLAG]    = 0;
        }
Esempio n. 18
0
        private void CreateTreeList()
        {
            int selectedchargeUserId = 0;

            if (chkChargeUser.Checked)
            {
                selectedchargeUserId = Convert.ToInt32(cboChargeUser.SelectedValue);
            }

            tvwAccountList.Nodes.Clear( );
            DataTable tbHandIn = AccountBookController.GetAccountList(dtpFrom.Value, dtpTo.Value);
            TreeNode  tdHandIn = new TreeNode( );

            tdHandIn.Text = "已交款";
            List <PrivyAccountBook> lstAllBooks = new List <PrivyAccountBook>( );

            #region 构造交款员树
            for (int i = 0; i < tbHandIn.Rows.Count; i++)
            {
                int chargeUserId = Convert.ToInt32(tbHandIn.Rows[i]["AccountCode"]);
                if (chkChargeUser.Checked && chargeUserId != selectedchargeUserId)
                {
                    continue;
                }

                if (tdHandIn.Nodes.Count == 0)
                {
                    TreeNode ndUser = new TreeNode( );
                    ndUser.Text = BaseDataController.GetName(BaseDataCatalog.人员列表, chargeUserId);
                    ndUser.Tag  = chargeUserId;
                    tdHandIn.Nodes.Add(ndUser);
                }
                else
                {
                    bool hasIntree = false;
                    foreach (TreeNode nd in tdHandIn.Nodes)
                    {
                        if (Convert.ToInt32(nd.Tag) == chargeUserId)
                        {
                            hasIntree = true;
                            break;
                        }
                    }
                    if (!hasIntree)
                    {
                        TreeNode ndUser = new TreeNode( );
                        ndUser.Text = BaseDataController.GetName(BaseDataCatalog.人员列表, chargeUserId);
                        ndUser.Tag  = chargeUserId;
                        tdHandIn.Nodes.Add(ndUser);
                    }
                }
            }
            #endregion

            #region 生成账单明细,并合并
            foreach (TreeNode ndUser in tdHandIn.Nodes)
            {
                int       chargeUserId  = Convert.ToInt32(ndUser.Tag);
                DataRow[] drsAccount    = tbHandIn.Select("ACCOUNTCODE=" + chargeUserId, "ACCOUNTDATE asc");
                int[]     accountIdList = new int[drsAccount.Length];
                for (int i = 0; i < drsAccount.Length; i++)
                {
                    accountIdList[i] = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]);
                }
                DataTable tbInvoice;
                DataTable tbInvoiceDetail;
                AccountBookController.GetAccountData(chargeUserId, accountIdList, out tbInvoice, out tbInvoiceDetail);
                //个人所有账单
                List <PrivyAccountBook> lstBook = new List <PrivyAccountBook>( );

                for (int i = 0; i < drsAccount.Length; i++)
                {
                    TreeNode ndDate = new TreeNode( );
                    ndDate.Text = Convert.ToDateTime(drsAccount[i]["ACCOUNTDATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                    int accountId         = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]);
                    PrivyAccountBook book = AccountBookController.GetPrivyAccountBook(chargeUserId, accountId, tbInvoice, tbInvoiceDetail, tbHandIn);
                    ndDate.Tag = book;
                    ndUser.Nodes.Add(ndDate);
                    lstBook.Add(book);
                }
                //PrivyAccountBook totalBook = AccountBookController.CollectPrivyAccountBook( lstBook );
                ndUser.Tag = new PrivyAccountBook();
                //lstAllBooks.Add( totalBook );
            }
            #endregion
            tvwAccountList.Nodes.Add(tdHandIn);
            //CollectAccountBook allBook = AccountBookController.CollectAllAccountBook( lstAllBooks );
            tdHandIn.Tag = new PrivyAccountBook();

            DataTable tbUnHandIn = AccountBookController.GetNotHandInAccountUser( );
            TreeNode  ndUnHandIn = new TreeNode( );
            List <PrivyAccountBook> lstAllnothandBook = new List <PrivyAccountBook>( );
            ndUnHandIn.Text = "未交款";
            for (int i = 0; i < tbUnHandIn.Rows.Count; i++)
            {
                TreeNode ndUnhandInUser = new TreeNode( );
                ndUnhandInUser.Text = tbUnHandIn.Rows[i]["CHARGENAME"].ToString().Trim();
                int chargeUserId = Convert.ToInt32(tbUnHandIn.Rows[i]["CHARGECODE"]);
                if (chkChargeUser.Checked && chargeUserId != selectedchargeUserId)
                {
                    continue;
                }

                //PrivyAccountBook book = AccountBookController.GetPrivyAccountBook( chargeUserId , 0 );
                ndUnhandInUser.Tag = new PrivyAccountBook();
                ndUnHandIn.Nodes.Add(ndUnhandInUser);
                // lstAllnothandBook.Add( book );
            }

            tvwAccountList.Nodes.Add(ndUnHandIn);
            //CollectAccountBook notHandBook = AccountBookController.CollectAllAccountBook( lstAllnothandBook );
            ndUnHandIn.Tag = new PrivyAccountBook();

            tvwAccountList.ExpandAll( );
        }
Esempio n. 19
0
        /// <summary>
        /// 初始化控件
        /// </summary>
        public void CreateControls()
        {
            propertyPanel.Controls.Clear();
            bool dtbegin = true;

            for (int i = 0; i < _paralist.Count; i++)
            {
                Paramater config = new Paramater();
                config = _paralist[i];

                Control ctrl = new Control();

                #region 设置控件和列样式
                if (config.UIC_TYPE == 2)
                {
                    ctrl = new CheckBox();
                    ((CheckBox)ctrl).Text     = config.PARAMETER_CN;
                    ((CheckBox)ctrl).AutoSize = true;
                }
                else if (config.UIC_TYPE == 1)
                {
                    ctrl = new ComboBox();
                    DataTable dtcopy = new DataTable();
                    if (config.ENUMEID > 0)
                    {
                        string    strWhere = HIS.BLL.Tables.base_enumeorder.ENUMEID + "=" + config.ENUMEID;
                        DataTable tb       = HIS.SYSTEM.Core.BindEntity <HIS.Model.BASE_ENUMEORDER> .CreateInstanceDAL(HIS.Base_BLL.BaseDataController.oleDb).GetList(strWhere);

                        if (config.ENUMEID == 1) //医生枚举
                        {
                            DataRow[] rows = tb.Select("enumvalue <> " + employeeid + "");
                            dtcopy = tb.Clone();
                            if (rows != null && rows.Length > 0)
                            {
                                dtcopy.Clear();
                                DataRow row = dtcopy.NewRow();
                                row["NAME"]      = employeename;
                                row["ENUMVALUE"] = employeeid;
                                dtcopy.Rows.Add(row);
                                for (int j = 0; j < rows.Length; j++)
                                {
                                    dtcopy.Rows.Add(tb.Rows[j].ItemArray);
                                }
                            }
                        }
                        else //if (HIS.BLL.Tables.base_enumeorder.ENUMEID.ToString().Trim() == "2") //科室枚举
                        {
                            DataRow[] rows = tb.Select("enumvalue <> " + _dept.DeptID + "");
                            dtcopy = tb.Clone();
                            if (rows != null && rows.Length > 0)
                            {
                                dtcopy.Clear();
                                DataRow row = dtcopy.NewRow();
                                row["NAME"]      = _dept.Name;;
                                row["ENUMVALUE"] = _dept.DeptID;
                                dtcopy.Rows.Add(row);
                                for (int j = 0; j < rows.Length; j++)
                                {
                                    dtcopy.Rows.Add(tb.Rows[j].ItemArray);
                                }
                            }
                        }
                        ((ComboBox)ctrl).DataSource       = dtcopy;
                        ((ComboBox)ctrl).DisplayMember    = HIS.BLL.Tables.base_enumeorder.NAME;
                        ((ComboBox)ctrl).ValueMember      = HIS.BLL.Tables.base_enumeorder.ENUMVALUE;
                        ((ComboBox)ctrl).DropDownStyle    = ComboBoxStyle.DropDown;
                        ((ComboBox)ctrl).MaxDropDownItems = 25;
                        ((ComboBox)ctrl).DropDownStyle    = ComboBoxStyle.DropDownList;
                        //((ComboBox)ctrl).Text = employeename;
                        //((ComboBox)ctrl).SelectedValue = employeeid.ToString();
                    }
                    else
                    {
                        //如果是外键,设置外键的数据来源和显示字段,值字段
                        try
                        {
                            DataTable tb = BaseDataController.GetBaseTableData(config.FOREIGNER_TABLE, new string[] { "rtrim(cast(" + config.FOREIGNER_FIELD_DB_NAME + " as char(30))) as " + config.FOREIGNER_FIELD_DB_NAME, config.FOREIGNER_FIELD_CN_NAME }, config.FOREIGNER_FILTER_SQL);
                            if (tb.Rows.Count > 0 && config.FOREIGNER_TABLE == "HIS_WORKERS")
                            {
                                if (isblobal == 0)
                                {
                                    DataTable dbfor = tb.Clone();
                                    DataRow[] rows  = tb.Select("workid=" + HIS.SYSTEM.Core.EntityConfig.WorkID);
                                    foreach (DataRow dr in rows)
                                    {
                                        dbfor.Rows.Add(dr.ItemArray);
                                    }
                                    tb = new DataTable();
                                    tb = dbfor;
                                }
                                else
                                {
                                    //DataRow drr = tb.NewRow();
                                    //drr[0] = 0;
                                    //drr[1] = "全部医院";
                                    //tb.Rows.Add(drr);
                                    for (int index = 0; index < tb.Rows.Count; index++)
                                    {
                                        if (Convert.ToInt32(tb.Rows[index]["workid"].ToString()) == 42)
                                        {
                                            tb.Rows[index]["workid"] = 0;
                                            break;
                                        }
                                    }
                                }
                            }


                            ((ComboBox)ctrl).DataSource       = tb;
                            ((ComboBox)ctrl).DisplayMember    = config.FOREIGNER_FIELD_CN_NAME;
                            ((ComboBox)ctrl).ValueMember      = config.FOREIGNER_FIELD_DB_NAME;
                            ((ComboBox)ctrl).DropDownStyle    = ComboBoxStyle.DropDown;
                            ((ComboBox)ctrl).MaxDropDownItems = 25;
                            ((ComboBox)ctrl).DropDownStyle    = ComboBoxStyle.DropDownList;
                        }
                        catch { }
                    }
                }
                else if (config.UIC_TYPE == 0)
                {
                    ctrl = new TextBox();
                    ((TextBox)ctrl).MaxLength = config.DATALENGTH;
                }
                else if (config.UIC_TYPE == 3)
                {
                    DateTimePicker dtpicter = new DateTimePicker();
                    dtpicter.CustomFormat = "yyyy-MM-dd HH:mm:ss";
                    dtpicter.Format       = DateTimePickerFormat.Custom;

                    if (dtbegin)
                    {
                        dtpicter.Value = Convert.ToDateTime(DateTime.Now.Date.ToString("yyyy-MM-dd") + " 00:00:00");
                        dtbegin        = false;
                    }
                    else
                    {
                        dtpicter.Value = Convert.ToDateTime(DateTime.Now.Date.ToString("yyyy-MM-dd") + " 23:59:59");
                    }
                    ctrl = dtpicter;
                }
                else
                {
                    ctrl         = new TextBox();
                    ctrl.Text    = employeeid.ToString();
                    ctrl.Visible = false;
                }



                #endregion

                #region 创建控件和列
                //定义标签
                Label lbl = new Label();
                lbl.Text     = config.PARAMETER_CN != "" ? config.PARAMETER_CN : config.PARAMETER;
                lbl.AutoSize = true;
                int lblWidth  = 0;
                int lblHeight = 0;
                using (System.Drawing.Graphics g = propertyPanel.CreateGraphics())
                {
                    System.Drawing.SizeF size = g.MeasureString(lbl.Text, propertyPanel.Font);
                    lblWidth  = Convert.ToInt32(size.Width);
                    lblHeight = Convert.ToInt32(size.Height);
                }

                //定义控件
                ctrl.Name     = config.PARAMETER;
                ctrl.Size     = new System.Drawing.Size(config.WIDTH, config.HEIGHT);
                ctrl.Location = new System.Drawing.Point(config.UIC_X_LOCA, config.UIC_Y_LOCA);
                ctrl.Enabled  = true;

                //ctrl.KeyPress += new KeyPressEventHandler(ctrl_KeyPress);
                ctrl.Tag = config;

                if (config.UIC_TYPE != 2 && config.UIC_TYPE != 4)
                {
                    lbl.Left = ctrl.Left - lblWidth - 4;
                    lbl.Top  = ctrl.Top + (ctrl.Height - lblHeight);
                    //if (!config.ALLOW_EMPTY)
                    //    lbl.ForeColor = System.Drawing.Color.Red;
                    propertyPanel.Controls.Add(lbl);
                }


                propertyPanel.Controls.Add(ctrl);


                #endregion
            }
        }
Esempio n. 20
0
 private void Awake()
 {
     userDataController = new UserDataController(this, this);
     baseDataController = new BaseDataController(this, null);
     levelUpController  = new LevelUpController(this, null);
 }
        private void btnStat_Click(object sender, EventArgs e)
        {
            SetControlEnable(false);

            DateTime     beginDate;
            DateTime     endDate;
            BaseReport   report = null;
            string       accountIdList;
            string       patTypeCode = "";
            int          statDay     = Convert.ToInt32(txtDay.Text);
            StatDateType dateType    = StatDateType.统计日;
            OPDBillKind  invoiceType = OPDBillKind.所有发票;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatDateType)))
            {
                if (obj.ToString( ) == cboDateType.Text)
                {
                    dateType = (StatDateType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(OPDBillKind)))
            {
                if (obj.ToString( ) == cboInvoiceType.Text)
                {
                    invoiceType = (OPDBillKind)obj;
                    break;
                }
            }
            if (chkPatType.Checked)
            {
                patTypeCode = cboPatType.SelectedValue.ToString( );
            }
            #endregion
            ReportController.GetReportBeginDateAndEndDate(dateType, statDay, 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");
            try
            {
                report           = new PatientFeeReport( );
                report.BeginDate = beginDate;
                report.EndDate   = endDate;
                ((PatientFeeReport)report).PatientTypeCode = patTypeCode;
                ((PatientFeeReport)report).InvoiceType     = invoiceType;
                ((PatientFeeReport)report).CurDocName      = chkCureDoc.Checked ? cboDoc.Text : "";
                ((PatientFeeReport)report).CurDeptName     = chkDept.Checked ? cboDept.Text : "";
                ((PatientFeeReport)report).ChargeName      = chkSfy.Checked ? cboCharge.Text : "";
                report.StatDateType  = dateType;
                report.AccountIdList = accountIdList;
                report.ReportTitle   = "门诊病人费用统计表";
                report.Lister        = BaseDataController.GetName(BaseDataCatalog.人员列表, employeeId); //PublicDataReader.GetEmployeeNameById( employeeId );

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

                for (int i = 0; i < dgvReport.Columns.Count; i++)
                {
                    if (i >= 7)
                    {
                        dgvReport.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                        dgvReport.Columns[i].Width = 80;
                    }
                    if (i < 8)
                    {
                        dgvReport.Columns[i].Frozen = true;
                    }
                }
            }
            catch
            {
                MessageBox.Show("统计发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetControlEnable(true);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 显示处方
        /// </summary>
        /// <param name="Prescriptions"></param>
        /// <param name="ReturnDrugDetailList"></param>
        private void ShowPrescriptions(Prescription[] Prescriptions, List <PrescriptionDetail> ReturnDrugDetailList)
        {
            dgvPresc.Rows.Clear( );
            loadPresc = true;
            for (int i = 0; i < Prescriptions.Length; i++)
            {
                for (int j = 0; j < Prescriptions[i].PresDetails.Length; j++)
                {
                    dgvPresc.Rows.Add( );
                    int row = dgvPresc.Rows.Count - 1;

                    dgvPresc["PrescID", row].Value  = Prescriptions[i].PrescriptionID;
                    dgvPresc["DetailID", row].Value = Prescriptions[i].PresDetails[j].DetailId;
                    dgvPresc["NO1", row].Value      = Convert.ToString(i + 1);
                    if (j == 0)
                    {
                        dgvPresc["NO2", row].Value = Convert.ToString(i + 1);
                    }
                    dgvPresc["Item_Name", row].Value = Prescriptions[i].PresDetails[j].Itemname;
                    dgvPresc["Standard", row].Value  = Prescriptions[i].PresDetails[j].Standard;
                    dgvPresc["Price", row].Value     = Prescriptions[i].PresDetails[j].Sell_price;
                    dgvPresc["Item_Unit", row].Value = Prescriptions[i].PresDetails[j].Unit; //大单位
                    dgvPresc["PACK_Unit", row].Value = Prescriptions[i].PresDetails[j].Unit; //大单位
                    string    base_unit  = "";
                    DataRow[] drBaseItem = dtbChargeItems.Select("isdrug = 1 and item_id=" + Prescriptions[i].PresDetails[j].ItemId.ToString( ));
                    if (drBaseItem.Length > 0)
                    {
                        base_unit = drBaseItem[0]["base_unit"].ToString( ).Trim( );
                    }
                    else
                    {
                        base_unit = Prescriptions[i].PresDetails[j].Unit;
                    }

                    dgvPresc["Base_Unit", row].Value = base_unit; //小单位
                    if (Prescriptions[i].PresDetails[j].BigitemCode == "01" || Prescriptions[i].PresDetails[j].BigitemCode == "02" || Prescriptions[i].PresDetails[j].BigitemCode == "03")
                    {
                        decimal baseNum = 0;
                        decimal packNum = 0;
                        GetPackNumAndBaseNum(Prescriptions[i].PresDetails[j].Amount, Prescriptions[i].PresDetails[j].RelationNum, out packNum, out baseNum);
                        decimal retBaseNum = 0;
                        decimal retPackNum = 0;
                        GetPackNumAndBaseNum(Prescriptions[i].PresDetails[j].DetailId, Prescriptions[i].PresDetails[j].ItemId, ReturnDrugDetailList, out retPackNum, out retBaseNum);

                        dgvPresc["PACK_NUM", row].Value      = packNum;
                        dgvPresc["ReturnPackNum", row].Value = retPackNum;

                        dgvPresc["BASE_NUM", row].Value      = baseNum;
                        dgvPresc["ReturnBaseNum", row].Value = retBaseNum;
                        //add zenghao
                        if (retPackNum > 0 || retBaseNum > 0)
                        {
                            this.btnAll.Enabled = false;
                        }
                    }
                    else
                    {
                        dgvPresc["PACK_NUM", row].Value      = 0;
                        dgvPresc["ReturnPackNum", row].Value = 0;
                        dgvPresc["BASE_NUM", row].Value      = Prescriptions[i].PresDetails[j].Amount;
                        dgvPresc["ReturnBaseNum", row].Value = 0;
                    }

                    dgvPresc["PresAmount", row].Value = Prescriptions[i].PresDetails[j].PresAmount;
                    //dgvPresc["EXEC_DEPT" , row].Value = PublicDataReader.GetDeptNameById( Convert.ToInt32(Prescriptions[i].ExecDeptCode) );
                    dgvPresc["EXEC_DEPT", row].Value     = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(Prescriptions[i].ExecDeptCode));
                    dgvPresc["EXEC_DEPT", row].Tag       = Prescriptions[i].ExecDeptCode;
                    dgvPresc["TotalCost", row].Value     = Prescriptions[i].PresDetails[j].Tolal_Fee;
                    dgvPresc["Item_ID", row].Value       = Prescriptions[i].PresDetails[j].ItemId;
                    dgvPresc["STATITEM_CODE", row].Value = Prescriptions[i].PresDetails[j].BigitemCode;
                    dgvPresc["Complex_Id", row].Value    = Prescriptions[i].PresDetails[j].ComplexId;
                    dgvPresc["HJXS", row].Value          = Prescriptions[i].PresDetails[j].RelationNum;
                    dgvPresc["PrescDoctor", row].Value   = Prescriptions[i].PresDocCode;
                    dgvPresc["PrescDept", row].Value     = Prescriptions[i].PresDeptCode;
                    dgvPresc["Selected", row].Value      = (short)1;
                    dgvPresc["Modified", row].Value      = 0;
                    dgvPresc["DRUG_FLAG", row].Value     = Prescriptions[i].Drug_Flag;
                    dgvPresc[DocPresId.Name, row].Value  = Prescriptions[i].DocPresId;
                    //颜色
                    for (int r = 0; r < dgvPresc.Columns.Count; r++)
                    {
                        dgvPresc.Rows[row].Cells[r].Style.ForeColor = Color.Blue;
                    }
                    dgvPresc_CellEndEdit(this, new DataGridViewCellEventArgs(dgvPresc.Columns["ReturnBaseNum"].Index, row));
                }
                dgvPresc.Rows.Add( );
                WriteSubTotalRow(dgvPresc.Rows.Count - 1);
            }
            if (dgvPresc.Rows.Count > 0)
            {
                dgvPresc.CurrentCell = dgvPresc["BASE_NUM", dgvPresc.Rows.Count - 1];
            }

            loadPresc = false;
        }
        /// <summary>
        /// 获取挂号统计报表(NAME,DATE,NUM)
        /// </summary>
        /// <param name="ViewType">0-按医生 1-按科室</param>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        private DataSet GetRegisterReport(int ViewType, DateTime beginDate, DateTime endDate)
        {
            DataTable tbReg = GetRegisterData(beginDate, endDate);

            DataTable tbResultByName = new DataTable();

            tbResultByName.TableName = "TB_A";
            tbResultByName.Columns.Add("CODE", Type.GetType("System.String"));
            tbResultByName.Columns.Add("NAME", Type.GetType("System.String"));
            tbResultByName.Columns.Add("NUM", Type.GetType("System.Int32"));
            tbResultByName.Columns.Add("MONEY", Type.GetType("System.Decimal"));

            DataTable tbResultByDate = new DataTable();

            tbResultByDate.TableName = "TB_B";
            tbResultByDate.Columns.Add("DATE", Type.GetType("System.String"));
            tbResultByDate.Columns.Add("NUM", Type.GetType("System.Int32"));

            string fileName = "";

            if (ViewType == 0)
            {
                fileName = "PRESDOCCODE";
            }
            else
            {
                fileName = "PRESDEPTCODE";
            }

            for (int i = 0; i < tbReg.Rows.Count; i++)
            {
                string    code = tbReg.Rows[i][fileName].ToString().Trim();
                DataRow[] drs  = tbResultByName.Select("CODE='" + code + "'");
                if (drs.Length == 0)
                {
                    DataRow dr = tbResultByName.NewRow();
                    dr["CODE"] = code;
                    if (ViewType == 0)
                    {
                        dr["NAME"] = code == "" ? "未指定" : BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(code));     //PublicDataReader.GetEmployeeNameById( Convert.ToInt32( code ) );
                    }
                    else
                    {
                        dr["NAME"] = code == "" ? "未指定" : BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(code));     //PublicDataReader.GetDeptNameById( Convert.ToInt32( code ) );
                    }
                    dr["NUM"] = tbReg.Rows[i]["REGNUM"];
                    //dr["MONEY"] = tbReg.Rows[i]["MONEY"];
                    tbResultByName.Rows.Add(dr);
                }
                else
                {
                    drs[0]["NUM"] = Convert.ToInt32(tbReg.Rows[i]["REGNUM"]) + (Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"]));
                    //drs[0]["MONEY"] = Convert.ToInt32( tbReg.Rows[i]["REGNUM"] ) + ( Convert.IsDBNull( drs[0]["MONEY"] ) ? 0 : Convert.ToDecimal( drs[0]["MONEY"] ) );
                }
                //日期
                drs = tbResultByDate.Select("DATE='" + Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd") + "'");
                if (drs.Length == 0)
                {
                    DataRow dr = tbResultByDate.NewRow();
                    dr["DATE"] = Convert.ToDateTime(tbReg.Rows[i]["PRESDATE"]).ToString("yyyy-MM-dd");
                    dr["NUM"]  = tbReg.Rows[i]["REGNUM"];
                    tbResultByDate.Rows.Add(dr);
                }
                else
                {
                    int num  = Convert.IsDBNull(drs[0]["NUM"]) ? 0 : Convert.ToInt32(drs[0]["NUM"]);
                    int num1 = Convert.IsDBNull(tbReg.Rows[i]["REGNUM"]) ? 0 : Convert.ToInt32(tbReg.Rows[i]["REGNUM"]);
                    num           = num + num1;
                    drs[0]["NUM"] = num;
                }
            }

            DataSet dsResult = new DataSet();

            dsResult.Tables.Add(tbResultByName);
            dsResult.Tables.Add(tbResultByDate);

            return(dsResult);
        }
Esempio n. 24
0
        /// <summary>
        /// 填充处方数据
        /// </summary>
        /// <param name="prescriptions">要填充的处方,Prescription[]类型的数组</param>
        /// <param name="descTable">填充的目标数据表</param>
        private void FillPrescData(Prescription[] prescriptions, DataTable descTable)
        {
            descTable.Rows.Clear( );

            for (int presIndex = 0; presIndex < prescriptions.Length; presIndex++)
            {
                PrescriptionDetail[] details = prescriptions[presIndex].PresDetails;

                for (int detailIndex = 0; detailIndex < details.Length; detailIndex++)
                {
                    DataRow dr = descTable.NewRow( );
                    #region 增加明细行
                    if (detailIndex == 0)
                    {
                        dr[COL_PRESNO] = presIndex + 1;
                    }
                    decimal pack_num  = 0;
                    string  pack_unit = "";
                    decimal base_num  = details[detailIndex].Amount;
                    string  base_unit = details[detailIndex].Unit.Trim();
                    if (details[detailIndex].BigitemCode == "01" || details[detailIndex].BigitemCode == "02" || details[detailIndex].BigitemCode == "03")
                    {
                        pack_num  = 0;
                        pack_unit = "";
                        base_num  = 0;
                        base_unit = "";
                        ConvertDrugAmountToPackNumAndBaseNum(Convert.ToInt32(details[detailIndex].ItemId), details[detailIndex].Amount, details[detailIndex].RelationNum,
                                                             out pack_num, out pack_unit, out base_num, out base_unit);
                    }
                    dr[COL_KEYWORD]           = "";
                    dr[COL_ITEM_NAME]         = details[detailIndex].Itemname.Trim();
                    dr[COL_ITEM_UNIT]         = details[detailIndex].Unit.Trim();
                    dr[COL_STANDARD]          = details[detailIndex].Standard.Trim();
                    dr[COL_SELL_PRICE]        = details[detailIndex].Sell_price;
                    dr[COL_PACK_NUM]          = pack_num;
                    dr[COL_PACK_UNIT]         = pack_unit;
                    dr[COL_BASE_NUM]          = base_num;
                    dr[COL_BASE_UNIT]         = base_unit;
                    dr[COL_PRES_DOSAGE]       = details[detailIndex].PresAmount;
                    dr[COL_PRES_DOC_NAME]     = BaseDataController.GetName(BaseDataCatalog.人员列表, Convert.ToInt32(prescriptions[presIndex].PresDocCode));
                    dr[COL_EXEC_DEPT_NAME]    = BaseDataController.GetName(BaseDataCatalog.科室列表, Convert.ToInt32(prescriptions[presIndex].ExecDeptCode));
                    dr[COL_TOTAL_FEE]         = details[detailIndex].Tolal_Fee;
                    dr[COL_SELECTED_FLAG]     = prescriptions[presIndex].Selected;
                    dr[COL_PRESMASTER_ID]     = prescriptions[presIndex].PrescriptionID;
                    dr[COL_PRESDETAIL_ID]     = details[detailIndex].DetailId;
                    dr[COL_PRESC_TYPE]        = prescriptions[presIndex].PrescType;
                    dr[COL_ITEM_ID]           = details[detailIndex].ItemId;
                    dr[COL_COMPLEX_ID]        = details[detailIndex].ComplexId;
                    dr[COL_BUY_PRICE]         = details[detailIndex].Buy_price;
                    dr[COL_RELATION_NUM]      = details[detailIndex].RelationNum;
                    dr[COL_PRES_DOC_ID]       = prescriptions[presIndex].PresDocCode;
                    dr[COL_PRES_DEPT_ID]      = prescriptions[presIndex].PresDeptCode;
                    dr[COL_EXEC_DEPT_ID]      = prescriptions[presIndex].ExecDeptCode;
                    dr[COL_DOC_PRESMASTER_ID] = prescriptions[presIndex].DocPresId;
                    dr[COL_DOC_PRESDETAIL_ID] = details[detailIndex].DocPrescDetailId;
                    dr[COL_BIGITEMCODE]       = details[detailIndex].BigitemCode;
                    dr[COL_MODIFY_FLAG]       = (short)0;
                    dr[COL_SUB_TOTAL_FLAG]    = (short)0;
                    dr[COL_PRESC_AMBIT]       = presIndex + 1;
                    #endregion
                    descTable.Rows.Add(dr);
                }
                #region 增加小计行
                DataRow drSubTotal = descTable.NewRow( );
                drSubTotal[COL_EXEC_DEPT_NAME] = "小  计";
                drSubTotal[COL_SELL_PRICE]     = DBNull.Value;
                drSubTotal[COL_PACK_NUM]       = DBNull.Value;
                drSubTotal[COL_BASE_NUM]       = DBNull.Value;
                drSubTotal[COL_SELECTED_FLAG]  = prescriptions[presIndex].Selected;
                drSubTotal[COL_SUB_TOTAL_FLAG] = (short)1;
                drSubTotal[COL_PRESC_AMBIT]    = presIndex + 1;
                drSubTotal[COL_TOTAL_FEE]      = prescriptions[presIndex].Total_Fee;
                descTable.Rows.Add(drSubTotal);
                drSubTotal[COL_TOTAL_FEE] = _calculatePrescriptionFee(descTable.Rows.IndexOf(drSubTotal));
                #endregion
            }
        }
Esempio n. 25
0
        private void btnStat_Click(object sender, EventArgs e)
        {
            DateTime      beginDate;
            DateTime      endDate;
            BaseReport    report = null;
            string        accountIdList;
            int           statDay        = Convert.ToInt32(txtDay.Text);
            StatDateType  dateType       = StatDateType.统计日;
            StatClassType statType       = StatClassType.门诊发票分类;
            StatObjctType statObjectType = StatObjctType.医生;
            ReportStyle   style          = ReportStyle.科目为标题列;

            #region 统计条件
            foreach (object obj in Enum.GetValues(typeof(StatDateType)))
            {
                if (obj.ToString( ) == cboDateType.Text)
                {
                    dateType = (StatDateType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(StatClassType)))
            {
                if (obj.ToString( ) == cboStatType.Text)
                {
                    statType = (StatClassType)obj;
                    break;
                }
            }
            foreach (object obj in Enum.GetValues(typeof(ReportStyle)))
            {
                if (obj.ToString( ) == cboStyle.Text)
                {
                    style = (ReportStyle)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, statDay, 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 );
                report.Lister = BaseDataController.GetName(BaseDataCatalog.人员列表, 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;


                if (chkChargeTotalInfo.Checked)
                {
                    StatTotalInfo();
                }
                else
                {
                    dgvTotalInfo.DataSource = null;
                }
            }
            catch (OperatorException oe)
            {
                MessageBox.Show(oe.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception err)
            {
                ErrorWriter.WriteLog(err.Message);
                MessageBox.Show("统计报表中发生错误!", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SetButtonEnable(true);
                Cursor = Cursors.Default;
            }
        }