Beispiel #1
0
 private void btnPayment_Click(object sender, EventArgs e)
 {
     pay             = new frmPayment();
     pay.FormClosed += new FormClosedEventHandler(form2_FormClosed);
     pay.ShowDialog();
     //paymentLabel1.Text = frmPayment.passtxt;
 }
Beispiel #2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            ////this.Hide();
            ////frmInv = new frmInvoice2();
            ////frmInv.Show();
            //


            // Action of Button Pay

            frmPayment frmpay = new frmPayment();

            frmpay.ShowDialog();


            DataGridViewCellCollection selectrow_cell = dgInv.SelectedRows[0].Cells;
            double newpay;

            try
            {
                newpay = double.Parse(frmpay.pay);
            }
            catch (Exception)
            {
                newpay = 0;
            }

            double oldpay  = double.Parse(dgInv.SelectedRows[0].Cells[5].Value + "");
            double balance = double.Parse(selectrow_cell[7].Value + "");

            if (newpay >= balance)
            {
                Connection.ExecuteScalar("Update Invoice set PaymentVerify=1, Balance=0,Payment=TotalPrice where InvoiceCode='" + selectrow_cell[0].Value + "'");
                if (newpay > balance)
                {
                    MessageBox.Show("U must Change Back : " + Environment.NewLine + (newpay - balance) + " $");
                }
                else
                {
                    double newpayment, newbalance;
                    newbalance = balance - newpay;
                    newpayment = newpay + oldpay;
                    Connection.ExecuteScalar("Update Invoice set Balance='" + newbalance + "',Payment='" + newpayment + "' where InvoiceCode='" + selectrow_cell[0].Value + "'");
                    frmInvoiceDetail_Load(this, null);
                }
            }
            else
            {
                double newpayment, newbalance;
                newbalance = balance - newpay;
                newpayment = newpay + oldpay;
                Connection.ExecuteScalar("Update Invoice set Balance='" + newbalance + "',Payment='" + newpayment + "' where InvoiceCode='" + selectrow_cell[0].Value + "'");

                frmInvoiceDetail_Load(this, null);
            }
        }
Beispiel #3
0
        private void metroTile1_Click(object sender, EventArgs e)
        {
            try
            {
                frmPayment frmpay = new frmPayment();
                frmpay.ShowDialog();

                DataGridViewCellCollection selectrow_cell = dgData.SelectedRows[0].Cells;
                double newpay;

                try
                {
                    newpay = double.Parse(frmpay.pay);
                }
                catch (Exception)
                {
                    newpay = 0;
                }

                double oldpay  = double.Parse(dgData.SelectedRows[0].Cells[3].Value + "");
                double balance = double.Parse(selectrow_cell[3].Value + "");
                if (newpay >= balance)
                {
                    Connection.ExecuteScalar("Update Purchase set Balance=0,Payment=Total where PurCode='" + selectrow_cell[0].Value + "'");
                    if (newpay > balance)
                    {
                        MessageBox.Show("U must Change Back : " + Environment.NewLine + (newpay - balance) + " $");
                    }
                    else
                    {
                        double newpayment, newbalance;
                        newbalance = balance - newpay;
                        newpayment = newpay + oldpay;
                        Connection.ExecuteScalar("Update Purchase set Balance='" + newbalance + "',Payment='" + newpayment + "' where PurCode='" + selectrow_cell[0].Value + "'");

                        frmPurchaseDetail_Load(this, null);
                    }
                }
                else
                {
                    double stackPay = balance - newpay;
                    Connection.ExecuteScalar("Update Purchase set Balance=" + stackPay + ",Payment=" + newpay + " where PurCode='" + selectrow_cell[0].Value + "'");
                    frmPurchaseDetail_Load(this, null);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #4
0
        private void btnPayment_Click(object sender, EventArgs e)
        {
            pay             = new frmPayment();
            pay.FormClosed += new FormClosedEventHandler(form2_FormClosed);
            pay.ShowDialog();

            double pays = Helper.ifnull(pay.txtAmount.Text) ? 0 : Helper.canParse(pay.txtAmount.Text)? double.Parse(pay.txtAmount.Text):0;

            double prices = Helper.ifnull(totalPriceLabel1.Text) ? 0 : Helper.canParse(totalPriceLabel1.Text)? double.Parse(totalPriceLabel1.Text):0;

            if (pays > prices)
            {
            }

            //if (double.Parse(pay.txtAmount.Text) > double.Parse(totalPriceLabel1.Text))
            //{

            //}
        }