private void Button_Click(object sender, RoutedEventArgs e)
        {
            double paid_amount = Convert.ToDouble(paid);
            double charge      = Convert.ToDouble(charge_amount);
            double change      = paid_amount - charge;

            if (change >= 0)
            {
                queryBtn.IsEnabled = true;
                MessageBoxResult result = MessageBox.Show("就诊卡号:" + cardId + "\r\n金额:" + charge_amount, "确认充值", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    double blance_after = blance_now + Convert.ToDouble(charge_amount);
                    Query  query        = new Query();
                    query.Update_bal(cardId, blance_after);
                    query_btn_Click(sender, e);
                    patient pa    = DtTransaction.Dt2patient(query.Query_by_patient_id(cardId));
                    string  path  = Print2word.patient2word(Convert.ToDouble(charge_amount), pa.Name, (string)Application.Current.Properties["userName"]);
                    Print   print = new Print(path);
                    print.Show();
                    queryBtn.IsEnabled = false;
                }
                else
                {
                    queryBtn.IsEnabled = true;
                }
            }
            else
            {
                queryBtn.IsEnabled = false;
                change_texbox.Text = change.ToString("0.00");
            }
        }
Esempio n. 2
0
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (remain > 0)
            {
                if (patient_fin.Price - Convert.ToDouble(price) >= 0)
                {
                    border.BorderBrush = System.Windows.Media.Brushes.Blue;
                    MessageBoxResult result   = MessageBox.Show("确认挂号?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
                    string           order_id = DateTime.Now.ToString("HHmmss") + Guid.NewGuid().ToString().Substring(5, 10);
                    if (result == MessageBoxResult.Yes)
                    {
                        string ID          = cardNo.Text.Trim();
                        Query  query       = new Query();
                        double balance_num = Convert.ToDouble(balance.Text);

                        query.Update_gua(ID, type, departments, "asc", balance_num, order_id);
                        CreateQr qr  = new CreateQr();
                        Bitmap   img = qr.ToQrcode(patient_fin, "HBTCM");//后一个参数为AES加密密码
                        BMPHelper.mitmap2jpg(img, @"model\tmp\test.jpg");
                        string picpath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\model\tmp\test.jpg";
                        string user    = (string)Application.Current.Properties["userName"];
                        string path    = Print2word.patient2word(patient_fin, order_id, departments, price, tip_type, user, picpath);
                        Print  print   = new Print(path);
                        print.Show();
                    }
                    read_Button_Click_1(sender, e);
                    query_Button_Click(sender, e);
                }
                else
                {
                    border.BorderBrush = System.Windows.Media.Brushes.Red;
                    MessageBox.Show("就诊卡余额不足,请充值后再试", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                border.BorderBrush = System.Windows.Media.Brushes.Red;
                MessageBox.Show("剩余号量不足", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }