Beispiel #1
0
        private void BtnAddPayment_Click(object sender, EventArgs e)
        {
            try
            {
                Receipt.branch        = Session.BranchId;
                Receipt.custId        = custID;
                Receipt.orderNumber   = LblOrderNo.Text;
                Receipt.OrderType     = orderType;
                Receipt.paymentAmount = Double.Parse(TxtAmount.Text);
                Receipt.receiptDate   = DateTime.Now.ToString("yyyy-MM-dd");
                Receipt.ReceiptNumber = LblReceiptNo.Text;
                receiptController.WriteReceipt(this);

                if (orderType == "LENSE")
                {
                    technovisionDataSetTableAdapters.contactlenseTableAdapter t = new technovisionDataSetTableAdapters.contactlenseTableAdapter();
                    t.UpdateBalanceByOrderNumber(double.Parse(LblDueAmount.Text) - double.Parse(TxtAmount.Text), orderNumber);
                    t.UpdateAdvanceByOrderNumber(Receipt.paymentAmount, orderNumber);
                    t.Dispose();
                    CommonFunctions.ShowSuccess(this, "New Advance Payment Added To " + LblOrderNo.Text);
                    InvoiceLenseCustomer rpt = new InvoiceLenseCustomer();
                    rpt.RecordSelectionFormula = "{contactlense1.OrderNumber} = '" + Receipt.orderNumber + "' AND {receipt1.ReceiptNumber} = '" + Receipt.ReceiptNumber + "' AND {contactlense1.Branch} =" + Session.BranchId;
                    rpt.PrintToPrinter(1, false, 1, 1);
                    new UI_REPORT_VIEWER(rpt).Show();

                    InvoiceLenseCompany rpt1 = new InvoiceLenseCompany();
                    rpt1.RecordSelectionFormula = "{contactlense1.OrderNumber} = '" + orderNumber + "'AND {receipt1.ReceiptNumber} = '" + LblReceiptNo.Text + "' AND {contactlense1.Branch} =" + Session.BranchId;
                    rpt1.PrintToPrinter(1, false, 1, 1);
                    new UI_REPORT_VIEWER(rpt1).Show();
                }
                if (orderType == "SPEC")
                {
                    technovisionDataSetTableAdapters.spectaclesTableAdapter t = new technovisionDataSetTableAdapters.spectaclesTableAdapter();
                    t.UpdateBalanceByOrderNumber(double.Parse(LblDueAmount.Text) - double.Parse(TxtAmount.Text), orderNumber);
                    t.UpdateAdvanceByOrderNumber(Receipt.paymentAmount, orderNumber);
                    t.Dispose();
                    CommonFunctions.ShowSuccess(this, "New Advance Payment Added To " + LblOrderNo.Text);
                    InvoiceSpecCustomer rpt = new InvoiceSpecCustomer();
                    rpt.RecordSelectionFormula = "{spectacles1.OrderNumber} ='" + Receipt.orderNumber + "' AND {receipt1.ReceiptNumber} = '" + Receipt.ReceiptNumber + "' AND {spectacles1.Branch} =" + Session.BranchId;
                    rpt.PrintToPrinter(1, false, 1, 1);
                    new UI_REPORT_VIEWER(rpt).Show();

                    InvoiceSpecCompany rpt1 = new InvoiceSpecCompany();
                    rpt1.RecordSelectionFormula = "{spectacles1.OrderNumber} ='" + orderNumber + "' AND {receipt1.ReceiptNumber} = '" + Receipt.ReceiptNumber + "' AND {spectacles1.Branch} =" + Session.BranchId;
                    rpt1.PrintToPrinter(1, false, 1, 1);
                    new UI_REPORT_VIEWER(rpt1).Show();
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.ShowError(this, ex.ToString());
            }
        }
Beispiel #2
0
 private void BtnAddPayment_Click(object sender, EventArgs e)
 {
     try
     {
         receiptController.FillReceipt(orderNumber, double.Parse(TxtAmount.Text), DateOrderDate.Value.ToString("yyyy-MM-dd"), orderType, custID);
         receiptController.WriteReceipt(this);
         if (orderType == "LENSE")
         {
             technovisionDataSetTableAdapters.contactlenseTableAdapter t = new technovisionDataSetTableAdapters.contactlenseTableAdapter();
             t.UpdateBalanceByOrderNumber(double.Parse(LblDueAmount.Text) - double.Parse(TxtAmount.Text), orderNumber);
             t.Dispose();
             CommonFunctions.ShowSuccess(this, "New Payment Added To " + LblOrderNo.Text);
             CommonFunctions.WriteUserLog(Session.Username, "New Payment Added To " + LblOrderNo.Text);
             this.receiptTableAdapter.Fill(this.technovisionDataSet.receipt);
             receiptBindingSource.Filter = "OrderNumber ='" + orderNumber + "' AND OrderType = '" + orderType + "' AND Branch = " + Session.BranchId;
             InvReceiptContactLense rpt = new InvReceiptContactLense();
             rpt.RecordSelectionFormula = "{receipt1.ReceiptNumber} ='" + LblReceiptNo.Text + "'";
             rpt.PrintToPrinter(2, false, 1, 1);
             new UI_REPORT_VIEWER(rpt).Show();
         }
         if (orderType == "SPEC")
         {
             technovisionDataSetTableAdapters.spectaclesTableAdapter t = new technovisionDataSetTableAdapters.spectaclesTableAdapter();
             t.UpdateBalanceByOrderNumber(double.Parse(LblDueAmount.Text) - double.Parse(TxtAmount.Text), orderNumber);
             t.Dispose();
             CommonFunctions.ShowSuccess(this, "New Payment Added To " + LblOrderNo.Text);
             CommonFunctions.WriteUserLog(Session.Username, "New Payment Added To " + LblOrderNo.Text);
             this.receiptTableAdapter.Fill(this.technovisionDataSet.receipt);
             receiptBindingSource.Filter = "OrderNumber ='" + orderNumber + "' AND OrderType = '" + orderType + "' AND Branch = " + Session.BranchId;
             InvReceipt rpt = new InvReceipt();
             rpt.RecordSelectionFormula = "{receipt1.ReceiptNumber} ='" + LblReceiptNo.Text + "'";
             rpt.PrintToPrinter(2, false, 1, 1);
             new UI_REPORT_VIEWER(rpt).Show();
         }
     }
     catch (Exception ex)
     {
         CommonFunctions.ShowError(this, ex.Message.ToString());
         CommonFunctions.WriteToErrorLog(ex.Message.ToString());
     }
 }