protected void btnSave_Click(object sender, EventArgs e) { String idInvoice = Request["idInvoice"]; String idInvoiceSupplier = ""; InvoiceClientManager invCM = new InvoiceClientManager(); InvoiceSupplierManager invSM = new InvoiceSupplierManager(); String paymentMethod = ddlPaymentsMethods.SelectedItem.ToString(); //Console.WriteLine(txtIdPaymentMethod.Text.ToString()); int idPaymentMethod = int.Parse(txtIdPaymentMethod.Text.ToString()); //Console.WriteLine(idPaymentMethod); DateTime paymentDate = DateTime.Parse(txtPaymentDate.Text); if (idInvoice.Length < 10) { if (invCM.verifyInvoiceClient(int.Parse(idInvoice)) == 1) { DOM.InvoiceClient invoice = invCM.loadInvoiceClientById(idInvoice); if (paymentMethod == "Transferencia") { paymentMethod = "Transferen."; } invoice.payMethod = paymentMethod; invoice.idPayMethod = idPaymentMethod; invoice.paymentDate = paymentDate; invoice.condition = 1; if (invCM.ModifyInvoiceClient(invoice)) { //Mensaje de exito Response.Redirect("~/CloseBillSuccess.aspx"); } } } else { idInvoiceSupplier = idInvoice.Replace(" ", String.Empty); if (invSM.verifyInvoiceSupplier(idInvoiceSupplier) == 1) { DOM.InvoiceSupplier invoice = invSM.loadSupplierById(idInvoiceSupplier); if (paymentMethod == "Transferencia") { paymentMethod = "Transferen."; } invoice.payMethod = paymentMethod; invoice.idPayMethod = idPaymentMethod; invoice.paymentDate = paymentDate; invoice.condition = 1; if (invSM.ModifyInvoiceSupplier(invoice)) { //Mensaje de exito Response.Redirect("~/CloseBillSuccess.aspx"); } } } }
protected void Page_Load(object sender, EventArgs e) { VerifySession(); String idSupplier = Request["idSupplier"]; InvoiceSupplierManager invoiceSupplierManager = new InvoiceSupplierManager(); InvoiceReceivingSupplierManager invoiceReceivingSupplierManager = new InvoiceReceivingSupplierManager(); invoiceSupplier(invoiceSupplierManager.LoadInvoiceSupplier(idSupplier), invoiceReceivingSupplierManager.LoadSupplier(idSupplier)); }
protected void Page_Load(object sender, EventArgs e) { VerifySession(); InvoiceClientManager invCM = new InvoiceClientManager(); InvoiceSupplierManager invSM = new InvoiceSupplierManager(); List <BillName> billWNameList = invCM.loadInvoicesClientT(); List <BillName> supplierbillWNameList = invSM.loadInvoicesSupplierT(); fillClientsGrd(billWNameList); fillSupplierGrd(supplierbillWNameList); }
protected void btnSearch_Click(object sender, EventArgs e) { InvoiceClientManager invoiceClientManager = new InvoiceClientManager(); InvoiceSupplierManager invoiceSupplierManager = new InvoiceSupplierManager(); if (DateTime.Parse(TxtStartDate.Text) > DateTime.Parse(TxtStartDate.Text) || DateTime.Parse(txtEndDate.Text) < DateTime.Parse(TxtStartDate.Text)) { Response.Write("<script> alert(" + "'Las fechas ingresadas son invalidas'" + ") </script>"); } else { List <DOM.InvoiceClient> listInvoiceClient = invoiceClientManager.LoadInvoiceClientsBydate(DateTime.Parse(TxtStartDate.Text), DateTime.Parse(txtEndDate.Text)); List <DOM.InvoiceSupplier> listInvoiceSupplier = invoiceSupplierManager.LoadInvoiceSupplierBydate(DateTime.Parse(TxtStartDate.Text), DateTime.Parse(txtEndDate.Text)); if (listInvoiceClient.Count > 0 && listInvoiceSupplier.Count > 0) { invoiceClient(listInvoiceClient); invoiceSupplier(listInvoiceSupplier); changebuttons(); } else { if (listInvoiceClient.Count > 0) { invoiceClient(listInvoiceClient); changebuttons(); } else { if (listInvoiceSupplier.Count > 0) { invoiceSupplier(listInvoiceSupplier); changebuttons(); } else { Response.Write("<script> alert(" + "'No se encontraron coincidencias'" + ") </script>"); } } } } }
private Hashtable GetSchedule() { Hashtable schedule = new Hashtable(); List <Reminder> reminderClientList = new List <Reminder>(); List <Reminder> reminderSupplierList = new List <Reminder>(); InvoiceClientManager clientMan = new InvoiceClientManager(); InvoiceSupplierManager supplierMan = new InvoiceSupplierManager(); reminderClientList = clientMan.LoadClientMonthReminder(); reminderSupplierList = supplierMan.LoadSupplierMonthReminder(); foreach (Reminder rem in reminderClientList) { schedule[rem.date.ToShortDateString()] = "Cliente: " + rem.description; } foreach (Reminder remS in reminderSupplierList) { schedule[remS.date.ToShortDateString()] = "Proveedor: " + remS.description; } return(schedule); }
protected void btnSave_Click(object sender, EventArgs e) { String idInvoice = Request["idInvoice"]; String idInvoiceSupplier = ""; InvoiceClientManager invCM = new InvoiceClientManager(); InvoiceSupplierManager invSM = new InvoiceSupplierManager(); DateTime paymentDate = DateTime.Parse(txtPaymentDate.Text); if (idInvoice.Length < 10) { if (invCM.verifyInvoiceClient(int.Parse(idInvoice)) == 1) { DOM.InvoiceClient invoice = invCM.loadInvoiceClientById(idInvoice); invoice.paymentDate = paymentDate; if (invCM.ModifyInvoiceClientPostpone(invoice)) { //Mensaje de exito Response.Redirect("~/PostponeBillSuccess.aspx"); } } } else { idInvoiceSupplier = idInvoice.Replace(" ", String.Empty); if (invSM.verifyInvoiceSupplier(idInvoiceSupplier) == 1) { DOM.InvoiceSupplier invoice = invSM.loadSupplierById(idInvoiceSupplier); invoice.paymentDate = paymentDate; if (invSM.ModifyInvoiceSupplierPostpone(invoice)) { //Mensaje de exito Response.Redirect("~/PostponeBillSuccess.aspx"); } } } }
protected void btnUploadInvoice_Click(object sender, EventArgs e) { //VALIDAR LA FECHA = 9999/99/99 // VAIDAR EL NULL DE LA FECHA DE PAGO string clientBillNumberCell = ""; string idClientCell = ""; string conditionClientCell = ""; string totalClientCell = ""; string dateClientCell = ""; // PARA HACER LA VALIDACION DE SI ES UN ARCHIVO QUE POSEE FACTURAS!! string dateSupplierCell = ""; string supplierBillNumberCell = ""; string idSupplierCell = ""; string totalSupplierCell = ""; if (isClient == true) { clientBillNumberCell = table.Rows[0][1].ToString(); idClientCell = table.Rows[0][8].ToString(); conditionClientCell = table.Rows[0][11].ToString(); totalClientCell = table.Rows[0][24].ToString(); dateClientCell = table.Rows[0][26].ToString(); } else { dateSupplierCell = table.Rows[0][3].ToString(); supplierBillNumberCell = table.Rows[0][4].ToString(); idSupplierCell = table.Rows[0][9].ToString(); totalSupplierCell = table.Rows[0][23].ToString(); } if (clientBillNumberCell == customerTemplateId && idClientCell == customerId && conditionClientCell == customerTemplateIndicator && totalClientCell == customerTotal && dateClientCell == customerDate) { for (int row = 1; row < table.Rows.Count; row++) { DateTime dateBill = DateTime.ParseExact(table.Rows[row][26].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime dateCompare = new DateTime(2100, 12, 30); int result = DateTime.Compare(dateBill, dateCompare); if (result < 0 && idClientCell.Length <= 35) { //relationship = "is earlier than"; InvoiceReceivingClientManager invoiceReceivingClientM = new InvoiceReceivingClientManager(); invoiceReceivingClientM.InsertInvoiceReceivingClient(new InvoiceReceivingClient(idClientCell, table.Rows[row][9].ToString(), table.Rows[row][7].ToString())); InvoiceClientManager invoiceClientManager = new InvoiceClientManager(); invoiceClientManager.InsertInvoiceClient(new DOM.InvoiceClient(int.Parse(clientBillNumberCell), idClientCell, 0, "", double.Parse(totalClientCell), 0, conditionClientCell, DateTime.ParseExact(dateClientCell, "dd/MM/yyyy", CultureInfo.InvariantCulture))); } else { //relationship = "is later than"; failDateBillClient++; } } lblInformationInvoice.Text = "Se ingresaron todas las facturas de cliente, y no se ingresaron " + failDateBillClient + " facturas fallidas por formato erróneo"; return; } else //VALIDAR LO MISMO EU ARRIBA PARA LAS DE PROVEEDOR { if (dateSupplierCell == supplierDate && supplierBillNumberCell == supplierTemplateId && idSupplierCell == supplierId && totalSupplierCell == supplierTotal) { for (int row1 = 1; row1 < table.Rows.Count; row1++) { DateTime dateBill = DateTime.ParseExact(table.Rows[row1][3].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture); DateTime dateCompare = new DateTime(2100, 12, 30); int result = DateTime.Compare(dateBill, dateCompare); if (result < 0 && supplierBillNumberCell.Length <= 50 && idSupplierCell.Length <= 35) { InvoiceReceivingSupplierManager invoiceReceivingSupplierM = new InvoiceReceivingSupplierManager(); invoiceReceivingSupplierM.InsertInvoiceReceivingSupplier(new InvoiceReceivingSupplier(table.Rows[row1][9].ToString(), table.Rows[row1][10].ToString())); InvoiceSupplierManager invoiceSupplierManager = new InvoiceSupplierManager(); invoiceSupplierManager.InsertInvoiceSupplier(new DOM.InvoiceSupplier(supplierBillNumberCell, idSupplierCell, 0, "", double.Parse(totalSupplierCell), 0, DateTime.ParseExact(dateSupplierCell, "dd/MM/yyyy", CultureInfo.InvariantCulture))); } else { //relationship = "is later than"; failDateBillSupplier++; } } lblInformationInvoice.Text = "Se ingresaron todas las facturas de proveedor, y no se ingresaron " + failDateBillSupplier + " facturas fallidas por formato erróneo"; return; } else { lblInformationInvoice.Text = noSupplierTemplateFile; return; } lblInformationInvoice.Text = noClientTemplateFile; } }