示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CRReciptPayment rpt = new CRReciptPayment();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void pbSave_Click(object sender, EventArgs e)
        {
            if (txtMoney.Text == "" || txtChange.Text == "")
            {
                MessageBox.Show("Please fill in the data");
            }
            else if (Convert.ToDouble(txtMoney.Text) < Convert.ToDouble(txtTotalPayment.Text))
            {
                MessageBox.Show("less money");
            }
            else
            {
                DialogResult dialogResult = MessageBox.Show("Do You Want To Save the Data ?", "Save", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    string info = "";
                    try
                    {
                        info = con.openconnection();
                        if (info == "OK")
                        {
                            string     query = "update Patient.Payment set isPay = '1' where Id_Payment = @idpayment";
                            SqlCommand com   = new SqlCommand(query, con.con);
                            //com.Parameters.AddWithValue("@ispay", "1");
                            com.Parameters.AddWithValue("@idpayment", txtIdPayment.Text);
                            if (com.ExecuteNonQuery() > 0)
                            {
                                info = "OK";
                                MessageBox.Show("Success Save data");

                                FCashierReciptPayment fcrp        = new FCashierReciptPayment();
                                CRReciptPayment       crrp        = new CRReciptPayment();
                                TextObject            totreatment = (TextObject)crrp.ReportDefinition.Sections["Section2"].ReportObjects["IdTreatment"];
                                totreatment.Text = txtIdTreatment.Text;
                                TextObject topatientname = (TextObject)crrp.ReportDefinition.Sections["Section2"].ReportObjects["PatientName"];
                                topatientname.Text = txtPatientName.Text;
                                TextObject todoctorname = (TextObject)crrp.ReportDefinition.Sections["Section2"].ReportObjects["DoctorName"];
                                todoctorname.Text = txtDoctorName.Text;
                                TextObject todiagnose = (TextObject)crrp.ReportDefinition.Sections["Section2"].ReportObjects["Diagnose"];
                                todiagnose.Text = txtDiagnose.Text;
                                //details drug
                                TextObject topaydrug = (TextObject)crrp.ReportDefinition.Sections["Section4"].ReportObjects["PaymentDrug"];
                                topaydrug.Text = txtPaymentDrug.Text;
                                TextObject topaydoc = (TextObject)crrp.ReportDefinition.Sections["Section4"].ReportObjects["PaymentDoctor"];
                                topaydoc.Text = txtPaymentDoctor.Text;
                                TextObject totalpay = (TextObject)crrp.ReportDefinition.Sections["Section4"].ReportObjects["TotalPayment"];
                                totalpay.Text = txtTotalPayment.Text;
                                TextObject tomoney = (TextObject)crrp.ReportDefinition.Sections["Section4"].ReportObjects["Moneyy"];
                                tomoney.Text = txtMoney.Text;
                                TextObject tochange = (TextObject)crrp.ReportDefinition.Sections["Section4"].ReportObjects["Changee"];
                                tochange.Text = txtChange.Text;

                                /*
                                 * string query1 = "select a.Id_RecipeDetail, b.DrugName, a.Qty, a.Dose from Recipe.RecipeDetail a join Recipe.Drug b on a.Id_Drug = b.Id_Drug join Recipe.Recipe c on c.Id_Recipe = a.Id_Recipe join Patient.Treatment x on x.Id_Recipe = c.Id_Recipe where Id_Treatment = '" + txtIdTreatment.Text + "'";
                                 * SqlCommand com1 = new SqlCommand(query1, con.con);
                                 * SqlDataReader dr1 = com1.ExecuteReader();
                                 * if (dr1.HasRows)
                                 * {
                                 *  DataTable dt = new DataTable();
                                 *  dt.Load(dr1);
                                 * }
                                 */
                                fcrp.crViewPayment.ReportSource = crrp;
                                fcrp.crViewPayment.Refresh();
                                fcrp.Show();
                                this.Hide();
                                txtTotalPayment.Clear();
                                txtPaymentDrug.Clear();
                                txtPaymentDoctor.Clear();
                                txtIdTreatment.Clear();
                                txtIdPayment.Clear();
                                txtPatientName.Clear();
                                txtDoctorName.Clear();
                                txtDiagnose.Clear();
                                txtDateTreatment.Clear();
                                txtMoney.Focus();

                                //txtIdPayment.Text = autoid();
                            }
                            else
                            {
                                info = "Gagal";
                            }
                        }
                        if (con.closeconnection() == "OK")
                        {
                            info = "OK";
                        }
                    }
                    catch (Exception xe)
                    {
                        MessageBox.Show(xe.Message);
                    }
                }
            }
        }