public void cs_pxEliminarDocumento(string Id) { try { //actualizar relacion y estado en tabla document. List <List <string> > registros = new clsEntityDocument(localDB).cs_pxObtenerPorResumenDiario(Id); clsEntityDocument doc; foreach (var item in registros) { doc = new clsEntityDocument(localDB).cs_fxObtenerUnoPorId(item[0].ToString().Trim()); //doc.Cs_pr_EstadoSCC = "2"; //doc.Cs_pr_EstadoSUNAT = "2"; doc.Cs_pr_Resumendiario = ""; doc.cs_pxActualizar(false, false); } //eliminar de summary documents y los relacionados: clsEntitySummaryDocuments Summary = new clsEntitySummaryDocuments(localDB).cs_fxObtenerUnoPorId(Id); clsEntitySummaryDocuments_Notes Summary_Notes = new clsEntitySummaryDocuments_Notes(localDB);//eliminado clsEntitySummaryDocuments_SummaryDocumentsLine Summary_Line = new clsEntitySummaryDocuments_SummaryDocumentsLine(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge Summary_Line_Allowance_Charge = new clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_BillingPayment Summary_Line_Billing_Payment = new clsEntitySummaryDocuments_SummaryDocumentsLine_BillingPayment(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_TaxTotal Summay_Line_Tax_Total = new clsEntitySummaryDocuments_SummaryDocumentsLine_TaxTotal(localDB); foreach (var item in Summary_Notes.cs_fxObtenerTodoPorSummaryId(Id)) { item.cs_pxElimnar(false); } foreach (var item in Summary_Line.cs_fxObtenerTodoPorCabeceraId(Id)) { foreach (var item1 in Summary_Line_Billing_Payment.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item1.cs_pxElimnar(false); } foreach (var item2 in Summary_Line_Allowance_Charge.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item2.cs_pxElimnar(false); } foreach (var item3 in Summay_Line_Tax_Total.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item3.cs_pxElimnar(false); } item.cs_pxElimnar(false); } Summary.cs_pxElimnar(false); } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("clsEntitySummaryDocuments cs_pxEliminarDocumento " + ex.ToString()); } }
//Cristhian|16/04/2018|FEI2-585 /*Creado para limpiar los items del resumen diario cuando se activa liberar documentos, ya que se detecto que * los items del resumen diario se estaban duplicando generando error en el envio del resumen diario*/ /*INICIO MODIFICACIóN*/ public void cs_pxEliminarDocumento(string Id, bool LiberarDocumentos) { try { clsEntitySummaryDocuments_Notes Summary_Notes = new clsEntitySummaryDocuments_Notes(localDB);//eliminado clsEntitySummaryDocuments_SummaryDocumentsLine Summary_Line = new clsEntitySummaryDocuments_SummaryDocumentsLine(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge Summary_Line_Allowance_Charge = new clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_BillingPayment Summary_Line_Billing_Payment = new clsEntitySummaryDocuments_SummaryDocumentsLine_BillingPayment(localDB); clsEntitySummaryDocuments_SummaryDocumentsLine_TaxTotal Summay_Line_Tax_Total = new clsEntitySummaryDocuments_SummaryDocumentsLine_TaxTotal(localDB); foreach (var item in Summary_Notes.cs_fxObtenerTodoPorSummaryId(Id)) { item.cs_pxElimnar(false); } foreach (var item in Summary_Line.cs_fxObtenerTodoPorCabeceraId(Id)) { foreach (var item1 in Summary_Line_Billing_Payment.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item1.cs_pxElimnar(false); } foreach (var item2 in Summary_Line_Allowance_Charge.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item2.cs_pxElimnar(false); } foreach (var item3 in Summay_Line_Tax_Total.cs_fxObtenerTodoPorCabeceraId(item.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id)) { item3.cs_pxElimnar(false); } item.cs_pxElimnar(false); } } catch (Exception ex) { clsBaseLog.cs_pxRegistarAdd("clsEntitySummaryDocuments cs_pxEliminarDocumento " + ex.ToString()); } }
public List <clsEntitySummaryDocuments_SummaryDocumentsLine> cs_fxObtenerTodoPorCabeceraIdYSerieYTipo(string CabeceraId, string Serie, string Tipo) { List <clsEntitySummaryDocuments_SummaryDocumentsLine> List_SummaryDocumentsLine; try { List_SummaryDocumentsLine = new List <clsEntitySummaryDocuments_SummaryDocumentsLine>(); OdbcDataReader datos = null; string sql = "SELECT * FROM " + cs_cmTabla + " WHERE cs_SummaryDocuments_Id=" + CabeceraId.Trim() + " AND cp3 = '" + Serie + "' ";// AND cp2 = '"+Tipo+"';"; //clsBaseConexion cn = new clsBaseConexion(); OdbcConnection cs_pxConexion_basedatos = new OdbcConnection(localDB.cs_prConexioncadenabasedatos()); cs_pxConexion_basedatos.Open(); datos = new OdbcCommand(sql, cs_pxConexion_basedatos).ExecuteReader(); clsEntitySummaryDocuments_SummaryDocumentsLine SummaryDocumentsLine; while (datos.Read()) { SummaryDocumentsLine = new clsEntitySummaryDocuments_SummaryDocumentsLine(localDB); SummaryDocumentsLine.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id = datos[0].ToString(); SummaryDocumentsLine.Cs_pr_SummaryDocuments_Id = datos[1].ToString(); SummaryDocumentsLine.Cs_tag_LineID = datos[2].ToString(); SummaryDocumentsLine.Cs_tag_DocumentTypeCode = datos[3].ToString(); SummaryDocumentsLine.Cs_tag_DocumentSerialID = datos[4].ToString(); SummaryDocumentsLine.Cs_tag_StartDocumentNumberID = datos[5].ToString(); SummaryDocumentsLine.Cs_tag_EndDocumentNumberID = datos[6].ToString(); SummaryDocumentsLine.Cs_tag_TotalAmount = datos[7].ToString(); SummaryDocumentsLine.Cs_tag_ConditionCode = datos[8].ToString(); List_SummaryDocumentsLine.Add(SummaryDocumentsLine); } cs_pxConexion_basedatos.Close(); return(List_SummaryDocumentsLine); } catch (Exception ex) { clsBaseMensaje.cs_pxMsgEr("ERR6", ex.ToString()); clsBaseLog.cs_pxRegistarAdd("clsEntitySummaryDocuments_SummaryDocumentsLine cs_fxObtenerTodoPorCabeceraIdYSerieYTipo" + ex.ToString()); return(null); } }
public List <List <string> > cs_pxObtenerPendientesEnvioRD() { List <List <string> > tabla_contenidos; try { tabla_contenidos = new List <List <string> >(); OdbcDataReader datos = null; string sql = "SELECT * FROM " + cs_cmTabla + " WHERE 1=1"; sql += " AND cp8 ='2' AND cp9 ='2' AND cp3 = '" + DateTime.Now.ToString("yyyy-MM-dd") + "'"; //clsBaseConexion cn = new clsBaseConexion(); OdbcConnection cs_pxConexion_basedatos = new OdbcConnection(localDB.cs_prConexioncadenabasedatos()); cs_pxConexion_basedatos.Open(); datos = new OdbcCommand(sql, cs_pxConexion_basedatos).ExecuteReader(); List <string> fila; while (datos.Read()) { List <clsEntitySummaryDocuments_SummaryDocumentsLine> items = new clsEntitySummaryDocuments_SummaryDocumentsLine(localDB).cs_fxObtenerTodoPorCabeceraId(datos[0].ToString()); //Devuelve los datos en el mismo orden que aparecen en la tabla. Considerar al llenar el datagridview. if (items.Count > 0) { fila = new List <string>(); for (int i = 0; i < datos.FieldCount; i++) { fila.Add(datos[i].ToString().Trim()); } tabla_contenidos.Add(fila); } } cs_pxConexion_basedatos.Close(); return(tabla_contenidos); } catch (Exception) { // clsBaseMensaje.cs_pxMsgEr("ERR6", ex.ToString()); return(null); } }