Пример #1
0
        public ReceiptPrint GeneratePrint(string hospitalCode, PatientData patient, HisOrderData orderData, SettleResultData resultData)
        {
            decimal yibaoTotal = 0;

            foreach (var form in orderData.ChargeItemForms)
            {
                foreach (var item in form.ChargeItems)
                {
                    // 参与结算的
                    if (!string.IsNullOrEmpty(item.ChargeItem.ChannelData?.Id))
                    {
                        yibaoTotal += item.Total;
                    }
                }
            }

            ReceiptPrint print = new ReceiptPrint();

            print.HospitalCode = hospitalCode;
            print.YibaoTotal   = yibaoTotal;
            //TODO:设置医保打印数据
            //print.PatientName = patient.P3;

            return(print);
        }
        public List <ReceiptPrint> PrintPaymentReceipt(string receiptId)
        {
            SqlDataAdapter adapter = new SqlDataAdapter();
            DataSet        ds      = new DataSet();

            SqlCommand          sqlCommand    = new SqlCommand();
            List <ReceiptPrint> receiptsPrint = new List <ReceiptPrint>();

            try
            {
                using (SqlConnection connection =
                           new SqlConnection(CommonUtility.Sqlconnectionstring))
                {
                    connection.Open();
                    sqlCommand.Connection  = connection;
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.CommandText = "Sp_getreceiptprintdata";
                    sqlCommand.Parameters.AddWithValue("@RECEIPTNUMBER", receiptId);
                    adapter.SelectCommand = sqlCommand;
                    adapter.Fill(ds);

                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        var objDateTime   = (DateTime)ds.Tables[0].Rows[i][5];
                        var objMemberType = (string)ds.Tables[0].Rows[i][4];

                        var resMemberType = "Membership fees";

                        if (!"REGULAR".Equals(objMemberType))
                        {
                            resMemberType = "Coaching Fees";
                        }

                        ReceiptPrint objReceiptPrint = new ReceiptPrint()
                        {
                            MemberCode   = (string)ds.Tables[0].Rows[i][1],
                            MemberName   = (string)ds.Tables[0].Rows[i][2],
                            MemberMobile = ds.Tables[0].Rows[i][3] + "",
                            MemberType   = resMemberType,

                            PaymentDate   = objDateTime.ToString("dd-MMM-yyyy"),
                            PaymentPeriod = "Month of - " + objDateTime.ToString("MMMM"),
                            PaymentAmount = ds.Tables[0].Rows[i][6] + "",

                            PaymentMode   = (string)ds.Tables[0].Rows[i][7],
                            ReceiptNumber = ds.Tables[0].Rows[i][8] + "",
                            SysRefNumber  = ds.Tables[0].Rows[i][11] + "",
                            Timeslot      = (string)ds.Tables[0].Rows[i][9],

                            CollectedBy = (string)ds.Tables[0].Rows[i][10],
                        };

                        if ("".Equals(objReceiptPrint.SysRefNumber))
                        {
                            objReceiptPrint.SysRefNumber = objReceiptPrint.ReceiptNumber;
                        }

                        receiptsPrint.Add(objReceiptPrint);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            finally
            {
                sqlCommand?.Connection?.Close();
            }

            return(receiptsPrint);
        }