Beispiel #1
0
        public NewPayment(DataSet bankSystemDataSet)
        {
            InitializeComponent();
            creditsDV = new DataView(bankSystemDataSet.Tables["tableOfCredits"]);
            this.bankSystemDataSet = bankSystemDataSet;
            tb_paymentID.Text      = PaymentID.ToString();
            lb_debName.DataSource  = bankSystemDataSet.Tables["tableOfDebitors"];
            lb_debID.DataSource    = bankSystemDataSet.Tables["tableOfDebitors"];

            lb_CreditID.DataSource      = creditsDV;
            lb_creditAmount.DataSource  = creditsDV;
            lb_creditBalance.DataSource = creditsDV;
        }
Beispiel #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            //Create Word Application
            word.Application wordApp = new word.Application();
            wordApp.Visible = true;

            //Create the Document
            word.Document wordDoc = wordApp.Documents.Add();

            //Create the Heading Parahraph
            word.Paragraph wordPara = wordDoc.Paragraphs.Add();
            wordPara.Range.Text = "End of Shift Report";
            object styleName = "Intense Quote";

            wordPara.Range.set_Style(ref styleName);
            wordPara.Range.InsertParagraphAfter();

            //Create a New Paragraph
            word.Paragraph wordPara2 = wordDoc.Paragraphs.Add();
            wordPara2.Range.Text = "This Document Contains all the crucial information regarding the Total Sales made per Shift. This information includes the Total Sales Made in the Shift, Each Sale made, their payment type and amounts. The total Amount of Sales Made this shift is: " + lblTotalSalesMade.Text + " " + "The Total Revenue made today is: R" + lblRevenue.Text;
            object styleName2 = "Subtle Emphasis";

            wordPara2.Range.set_Style(ref styleName2);
            wordPara2.Range.InsertParagraphAfter();


            int    PaymentID;
            double PaumentAmount;
            string PaymentDate;
            double PaymentVAT;
            double AmountReceived;
            double Change;
            int    PaymentTypeID;
            string Description;
            string Type;

            SqlConnection sqlcon = new SqlConnection(Globals.ConnectionString);

            sqlcon.Open();
            string        cmd    = "SELECT PaymentID, PaymentAmount, PaymentDate, PaymentVAt, AmountReceived, Change, PaymentTypeID FROM Payment WHERE PaymentDate ='" + lblDate.Text + "'";
            SqlCommand    sqlcom = new SqlCommand(cmd, sqlcon);
            SqlDataReader dr     = sqlcom.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    PaymentID      = Convert.ToInt32((dr["PaymentID"]));
                    PaumentAmount  = Convert.ToDouble((dr["PaymentAmount"]));
                    PaymentDate    = (dr["PaymentDate"].ToString());
                    PaymentVAT     = Convert.ToDouble((dr["PaymentVAt"]));
                    AmountReceived = Convert.ToDouble((dr["AmountReceived"]));
                    Change         = Convert.ToDouble((dr["Change"]));
                    PaymentTypeID  = Convert.ToInt32((dr["PaymentTypeID"]));

                    if (PaymentTypeID == 1)
                    {
                        Type = "Cash Sale";
                    }
                    else
                    {
                        Type = "Credit Card Sale";
                    }

                    Details = "Payment ID: " + PaymentID.ToString() + "\n" +
                              "Payment Amount: R" + PaumentAmount.ToString() + "\n" +
                              "Payment Date: " + PaymentDate.ToString() + "\n" +
                              "VAT: R" + PaymentVAT.ToString() + "\n" +
                              "Amount Received: R" + AmountReceived.ToString() + "\n" +
                              "Change: R" + Change.ToString() + "\n" +
                              "Payment Type: " + Type.ToString() + "\n";


                    word.Paragraph wordPara3  = wordDoc.Paragraphs.Add();
                    object         styleName3 = "List Paragraph";
                    wordPara3.Range.set_Style(ref styleName3);
                    wordPara3.Range.InsertParagraphAfter();
                    wordPara3.Range.Text = Details;
                }
            }

            dr.Close();
            sqlcon.Close();
        }