Exemplo n.º 1
0
 private void BtnPrintBothCopies_Click(object sender, EventArgs e)
 {
     try
     {
         if (OrderType == "S")
         {
             InvoiceSpecCustomer rpt2 = new InvoiceSpecCustomer();
             rpt2.RecordSelectionFormula = "{spectacles1.OrderNumber} ='" + OrderNumber + "' AND {receipt1.ReceiptNumber} = '" + ReceiptNumber + "' AND {spectacles1.Branch} =" + Session.BranchId;
             rpt2.PrintToPrinter(1, false, 1, 1);
             InvoiceSpecCompany rpt = new InvoiceSpecCompany();
             rpt.RecordSelectionFormula = "{spectacles1.OrderNumber} ='" + OrderNumber + "' AND {receipt1.ReceiptNumber} = '" + ReceiptNumber + "' AND {spectacles1.Branch} =" + Session.BranchId;
             rpt.PrintToPrinter(1, false, 1, 1);
         }
         else if (OrderType == "L")
         {
             InvoiceLenseCustomer rpt2 = new InvoiceLenseCustomer();
             rpt2.RecordSelectionFormula = "{contactlense1.OrderNumber} = '" + OrderNumber + "' AND {receipt1.ReceiptNumber} = '" + ReceiptNumber + "' AND {contactlense1.Branch} =" + Session.BranchId;
             rpt2.PrintToPrinter(1, false, 1, 1);
             InvoiceLenseCompany rpt = new InvoiceLenseCompany();
             rpt.RecordSelectionFormula = "{contactlense1.OrderNumber} = '" + OrderNumber + "' AND {receipt1.ReceiptNumber} = '" + ReceiptNumber + "' AND {contactlense1.Branch} =" + Session.BranchId;
             rpt.PrintToPrinter(1, false, 1, 1);
         }
     }
     catch (Exception ex)
     {
         CommonFunctions.ShowError(this, ex.Message.ToString());
     }
 }
Exemplo n.º 2
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());
            }
        }
 private void BtnPrintCompanyCopy_Click(object sender, EventArgs e)
 {
     try
     {
         if (RadioSpectacles.Checked == true)
         {
             InvoiceSpecCompany rpt = new InvoiceSpecCompany();
             rpt.RecordSelectionFormula = "{spectacles1.OrderNumber} ='" + GridSpectacle.SelectedRows[0].Cells[1].Value.ToString() + "' AND {spectacles1.Branch} =" + Session.BranchId;
             new UI_REPORT_VIEWER(rpt).Show();
             rpt.PrintToPrinter(1, false, 1, 1);
         }
         else if (RadioContactLense.Checked == true)
         {
             InvoiceLenseCompany rpt = new InvoiceLenseCompany();
             rpt.RecordSelectionFormula = "{contactlense1.OrderNumber} = '" + GridContactLense.SelectedRows[0].Cells[1].Value.ToString() + "' AND {contactlense1.Branch} =" + Session.BranchId;
             new UI_REPORT_VIEWER(rpt).Show();
             rpt.PrintToPrinter(1, false, 1, 1);
         }
     }
     catch (Exception ex)
     {
         CommonFunctions.ShowError(this, ex.Message.ToString());
     }
 }