예제 #1
0
        private string Postprepay()
        {
            AdvanceRecordData AdvData         = new AdvanceRecordData();
            bool             IfForegift       = false;//不确定是否以后会在转账时扣住院押金
            string           AdvanceID        = "";
            ChargeTypeFacade chargeTypeFacade = new ChargeTypeFacade();
            DataRow          dr = AdvData.Tables[0].NewRow();

            dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = ""; //开户银行
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = ""; //支票号
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] = GetInHosInfo(_inHosID).Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]          = _inHosID;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID]         = _inHosOfficeID;//this.txtZyks.Text;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE]      = new CommonFacade().GetServerDateTime().ToString("yyyy-MM-dd HH:mm:ss.ffff");
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]       = SysOperatorInfo.OperatorID;

            //支付类型ID及支付类型名称
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID] = SkyComm.getvalue("住院预交金充值方式_门诊预交金").ToString();//case21248 2015-5-4 yuanxiaoxia ID字段来源于界面加载
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODE]   = "门诊预交金";
            decimal ForegiftMoney = 0;

            if (IfForegift == true)
            {
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY] = DecimalRound.Round(Convert.ToDecimal(this.lblhm.Text) - ForegiftMoney, 2);
            }
            else
            {
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY] = DecimalRound.Round(Convert.ToDecimal(this.lblhm.Text), 2);
            }

            dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID] = string.Empty;
            AdvData.Tables[0].Rows.Add(dr);

            try
            {
                AdvanceRecordFacade fac = new AdvanceRecordFacade();
                AdvanceID = fac.insertEntity(AdvData.GetChanges(), IfForegift);
                SkyComm.GetCardBalance();
                this.lblMzYe.Text = SkyComm.cardBlance.ToString();
                this.lblZyYe.Text = Convert.ToString(Convert.ToDecimal(this.lblhm.Text) + Convert.ToDecimal(lblZyYe.Text));
            }
            catch (Exception err)
            {
                SkyComm.ShowMessageInfo(err.Message);
                AdvData.Tables[0].Clear();
                AdvData.Clear();
                return("");
            }
            return(AdvanceID);
        }
        public void inHosSave(DataSet inHosData, decimal RechargeMoney, string hisNo, string bankNo)
        {
            AdvanceRecordData AdvData = new AdvanceRecordData();
            DataRow           dr      = AdvData.Tables[0].NewRow();

            dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = hisNo;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = "";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] =
                inHosData.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();
            ;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]  = inHosData.Tables[0].Rows[0]["INHOSID"].ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID] = inHosData.Tables[0].Rows[0]["INHOSOFFICEID"].ToString();
            //this.txtZyks.Text;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE] = new CommonFacade().GetServerDateTime();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]  = SysOperatorInfo.OperatorID;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID]   = SkyComm.getvalue("住院预交金充值方式_微信").ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY]    = RechargeMoney;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID]   = string.Empty;
            AdvData.Tables[0].Rows.Add(dr);
            AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();

            string    advanceid  = string.Empty;
            Hashtable BankTranht = new Hashtable();

            BankTranht.Add("SEQNO", hisNo);
            BankTranht.Add("MONEY", RechargeMoney);
            BankTranht.Add("OPERATORID", SysOperatorInfo.OperatorCode);
            BankTranht.Add("POSNO", AutoHostConfig.PosNo);
            BankTranht.Add("DIAGNOSEID", SkyComm.DiagnoseID);
            BankTranht.Add("CARDID", SkyComm.cardInfoStruct.CardNo);
            BankTranht.Add("BANKSEQNO", bankNo);
            CardAuthorizationData   eCardAuthorizationData   = new CardAuthorizationData();
            CardAuthorizationFacade eCardAuthorizationFacade = new CardAuthorizationFacade();

            eCardAuthorizationData = (CardAuthorizationData)eCardAuthorizationFacade.SelectPatientAndCardInfoByCardID(SkyComm.cardInfoStruct.CardNo);
//            eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][
//                CardAuthorizationData.T_CARD_AUTHORIZATION_BANKTRANSNO] = BankTranht["BANKSEQNO"].ToString();

            advanceid = theAdvanceRecordFacade.insertEntity(AdvData, false);
            string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceid);

            PrintInfo("住院预交金充值凭证", receiptID, RechargeMoney.ToString(), advanceid, inHosData);
        }
예제 #3
0
        private void lblCashStored_Click(object sender, EventArgs e)
        {
            btnEnd.Enabled = false;
            bool           errorFlag = false;//错误标识
            WaitDialogForm form      = new WaitDialogForm("正在存钞中,请稍候...", "正在组织数据,请稍候......", new Size(240, 60));

            try
            {
                MoneyServer.NotAllowCashin();

                //拍照,纸币器
                switch (AutoHostConfig.ReadCardType)
                {
                case "XUHUI":
                case "XUHUIM1":
                    AutoServiceSDK.SdkService.Common_XH camera = new AutoServiceSDK.SdkService.Common_XH();
                    camera.TakeCameraEnd();
                    camera.DoorLightClose(LightTypeenum.纸币器);
                    break;

                default:
                    break;
                }

                timer2.Stop();
                timer1.Stop();

                #region 休眠3秒以后重新获取纸币金额
                Thread.Sleep(5000);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后休眠2秒重新获取存钞明细");
                int InMoney = MoneyServer.GetInMoney(AutoHostConfig.Machineno, SysOperatorInfo.OperatorID);
                Skynet.LoggingService.LogService.GlobalInfoMessage("在结束预存之后重新获取存钞明细金额:" + InMoney);
                if (InMoney > 0)
                {
                    //投入数量
                    int intOld = Convert.ToInt32(lblAmount.Text) + 1;
                    lblAmount.Text = intOld.ToString();

                    //投入金额
                    RechargeMoney += Convert.ToDecimal(InMoney);
                    RechargeMoney  = DecimalRound.Round(RechargeMoney, 2);
                    lblMoney.Text  = RechargeMoney.ToString();
                }
                #endregion

                if (RechargeMoney == 0)
                {
                    btnClose_Click(null, null);
                    return;
                }

                ucTime1.timer1.Stop();

                #region 预交金充值
                AdvanceRecordData AdvData = new AdvanceRecordData();
                string            strlsh  = DateTime.Now.ToString("yyMMddHHmmss") + SysOperatorInfo.OperatorID + GenValidateCode();
                DataRow           dr      = AdvData.Tables[0].NewRow();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
                dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = strlsh;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = "";
                dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] = inHosData.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]          = inHosData.Tables[0].Rows[0]["INHOSID"].ToString();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID]         = inHosData.Tables[0].Rows[0]["INHOSOFFICEID"].ToString();//this.txtZyks.Text;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE]      = new CommonFacade().GetServerDateTime();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]       = SysOperatorInfo.OperatorID;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID]        = SkyComm.getvalue("住院预交金充值方式_现金").ToString();
                dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY]         = RechargeMoney;
                dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID]        = string.Empty;
                AdvData.Tables[0].Rows.Add(dr);
                AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();
                string advanceid = string.Empty;
                try
                {
                    advanceid = theAdvanceRecordFacade.insertEntity(AdvData, false);
                    if (advanceid == "")
                    {
                        SkyComm.ShowMessageInfo("住院预交金充值失败,请与医院相关人员联系!");
                        errorFlag = true;
                    }
                }
                catch (Exception ex)
                {
                    LogService.GlobalInfoMessage("收预交款失败:" + ex.Message);
                    if (ex.Message.IndexOf("您已经没有可用发票") >= 0)
                    {
                        SkyComm.ShowMessageInfo("住院预交金充值失败,请与医院相关人员联系!");
                        errorFlag = true;
                    }
                }
                #endregion
                Skynet.LoggingService.LogService.GlobalInfoMessage("充值成功");
                if (advanceid != "")
                {
                    string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceid);

                    //打印充值凭证
                    PrintInfo("住院预交金充值凭证", receiptID, RechargeMoney.ToString(), advanceid);
                }
            }
            catch (Exception ex)
            {
                SkyComm.ShowMessageInfo("存钞失败:" + ex.Message);
                errorFlag = true;
                Skynet.LoggingService.LogService.GlobalInfoMessage("存钞失败:" + ex.Message);
            }
            finally
            {
                MoneyServer.ClosePort();
                form.Close();
                form.Dispose();

                btnEnd.Enabled = true;
            }
            if (!errorFlag)
            {
                decimal old_YE = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                SkyComm.ShowMessageInfo("您成功充值" + RechargeMoney + "元!住院预交金余额" + (RechargeMoney + old_YE).ToString("0.00##") + "元!");
            }
            else
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("住院预交金现金充值操作失败:患者诊疗号【" + SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["DIAGNOSEID"].ToString() + "】,患者姓名【" + SkyComm.eCardAuthorizationData.Tables[0].Rows[0]["PATIENTNAME"].ToString() + "】,现金充值金额【" + RechargeMoney + "】元");
            }
            SkyComm.CloseWin(this);
        }
        private void Saving(decimal money)
        {
            if (eCardSavingFacade == null)
            {
                eCardSavingFacade = new CardSavingFacade();
            }

            if (SkyComm.eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows.Count <= 0)
            {
                MyAlert frm = new MyAlert(AlertTypeenum.信息, "此操作没有找到所需要的患者信息!");
                frm.ShowDialog();
                return;
            }

            DataSet cardSavingData = new DataSet();
            POSBase Posfac         = IPOSFactory.CreateIPOS(AutoHostConfig.PosInterfaceType);

            if (Posfac == null)
            {
                SkyComm.ShowMessageInfo("银联POS接口配置不正确,请与管理员联系!");
                return;
            }

            ValidateCode vc       = new ValidateCode();
            string       HisSeqNo = string.Empty;

            HisSeqNo = DateTime.Now.ToString("yyMMddHHmmss") + SysOperatorInfo.OperatorID + vc.GenValidateCode(4);

            #region 住院预交金充值
            AdvanceRecordData AdvData = new AdvanceRecordData();
            DataRow           dr      = AdvData.Tables[0].NewRow();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_ADVANCEID]        = "新增";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_BUSINESSBANK]     = HisSeqNo;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CANCELMARK]       = 0;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CHEQUEID]         = "";
            dr[AdvanceRecordData.H_ADVANCE_RECORD_CURRENTINHOSMARK] = inHosData.Tables[0].Rows[0]["CURRENTINHOSMARK"].ToString();;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_INHOSID]          = inHosData.Tables[0].Rows[0]["INHOSID"].ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OFFICEID]         = inHosData.Tables[0].Rows[0]["INHOSOFFICEID"].ToString();//this.txtZyks.Text;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATEDATE]      = new CommonFacade().GetServerDateTime();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_OPERATORID]       = SysOperatorInfo.OperatorID;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMODEID]        = SkyComm.getvalue("住院预交金充值方式_银行卡").ToString();
            dr[AdvanceRecordData.H_ADVANCE_RECORD_PAYMONEY]         = RechargeMoney;
            dr[AdvanceRecordData.H_ADVANCE_RECORD_RECEIPTID]        = string.Empty;
            AdvData.Tables[0].Rows.Add(dr);
            AdvanceRecordFacade theAdvanceRecordFacade = new AdvanceRecordFacade();
            #endregion
            string    advanceid  = string.Empty;
            Hashtable BankTranht = new Hashtable();
            BankTranht.Add("SEQNO", HisSeqNo);
            BankTranht.Add("MONEY", money);
            BankTranht.Add("OPERATORID", SysOperatorInfo.OperatorCode);
            BankTranht.Add("POSNO", AutoHostConfig.PosNo);
            BankTranht.Add("DIAGNOSEID", SkyComm.DiagnoseID);
            BankTranht.Add("CARDID", SkyComm.cardInfoStruct.CardNo);

            if (AutoHostConfig.PosInterfaceType.Equals("锡盟新利"))//锡盟新利 弹出错误提示
            {
                try
                {
                    Posfac.Trans("1", BankTranht);
                }
                catch (Exception ex)
                {
                    SkyComm.ShowMessageInfo(ex.Message.ToString());
                    return;
                }
            }
            else
            {
                Posfac.Trans("1", BankTranht);
            }


            if (BankTranht["CARDNO"] != null)
            {
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_CHECKLOT]    = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKCARDNO]  = BankTranht["CARDNO"].ToString();
                eCardAuthorizationData.Tables["T_CARD_AUTHORIZATION"].Rows[0][CardAuthorizationData.T_CARD_AUTHORIZATION_BANKTRANSNO] = BankTranht["BANKSEQNO"].ToString();
            }

            try
            {
                advanceid = theAdvanceRecordFacade.insertEntity(AdvData, false);
                Posfac.Trans("2", BankTranht);
                Savingsucceed = 1;
            }
            catch (Exception ex)
            {
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS保存失败:" + ex.Message + "\r\n开始调用撤消方法");
                SkyComm.ShowMessageInfo("预交金充值失败,需要撤销银行交易,请按POS机提示操作,点击确定后,请重新插入银行卡!");
                Posfac.Trans("-2", BankTranht);
                Skynet.LoggingService.LogService.GlobalInfoMessage("POS接口调用成功,HIS失败,调用银行撤消完成!");
                SkyComm.ShowMessageInfo("银行交易失败,充值金额已退回卡,请重新充值!");
                //SkynetMessage.MsgInfo("HIS充值失败:"+ex.Message);
                return;
            }
            //SkyComm.GetCardBalance();

            if (Savingsucceed == 1)
            {
                string receiptID = theAdvanceRecordFacade.GetReceiptIDByAdvanceID(advanceid);
                //打印充值凭证
                PrintInfo("住院预交金充值凭证", receiptID, money.ToString(), advanceid, HisSeqNo);



                decimal old_YE = Convert.ToDecimal(inHosData.Tables[0].Rows[0]["BALANCEMONEY"].ToString());
                SkyComm.ShowMessageInfo("您成功充值" + money + "元!卡中余额" + (old_YE + money).ToString("0.00##") + "元!");
                string _isPrint = SkyComm.getvalue("锡盟预交款打印凭证");  //Case 31629 锡盟预交款打印凭证
                _isPrint = string.IsNullOrEmpty(_isPrint) ? "0" : "1";

                if (_isPrint.Equals("0"))
                {
                    try
                    {
                        MoneyTransferPresenter moneyTransferPresenter = new MoneyTransferPresenter();

                        DataSet dataSet = moneyTransferPresenter.getBankInfo(SkyComm.DiagnoseID, HisSeqNo);
                        dataSet.WriteXml(Application.StartupPath + @"\\ReportXml\\" + "银行pos凭证" + SkyComm.DiagnoseID + ".xml");
                        if (!File.Exists(Application.StartupPath + @"\\Reports\\" + "银行pos凭证" + ".frx"))
                        {
                            SkynetMessage.MsgInfo("银行pos凭证" + ".frx报表文件不存在,无法打印.");
                            return;
                        }
                        //Common_XH theCamera_XH = new Common_XH();
                        //theCamera_XH.DoorLightOpen(LightTypeenum.凭条, LightOpenTypeenum.闪烁);
                        PrintManager print = new PrintManager();
                        print.InitReport("银行pos凭证");
                        print.AddData(dataSet.Tables[0], "pos");
                        print.Print();
                        print.Dispose();
                    }
                    catch (Exception e)
                    {
                    }
                }
            }
            SkyComm.CloseWin(this);
        }