示例#1
0
        internal List <clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge> cs_fxObtenerTodoPorCabeceraId(string Id)
        {
            List <clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge> List_SummaryDocumentsLine_AllowanceCharge = new List <clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge>();

            try
            {
                OdbcDataReader datos = null;
                string         sql   = "SELECT * FROM " + cs_cmTabla + " WHERE cs_SummaryDocuments_SummaryDocumentsLine_Id=" + Id.Trim() + " ;";
                //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_AllowanceCharge SummaryDocumentsLine_AllowanceCharge;
                while (datos.Read())
                {
                    SummaryDocumentsLine_AllowanceCharge = new clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge(localDB);
                    SummaryDocumentsLine_AllowanceCharge.Cs_pr_SummaryDocuments_SummaryDocumentsLine_AllowanceCharge_Id = datos[0].ToString();
                    SummaryDocumentsLine_AllowanceCharge.Cs_pr_SummaryDocuments_SummaryDocumentsLine_Id = datos[1].ToString();
                    SummaryDocumentsLine_AllowanceCharge.Cs_tag_ChargeIndicator = datos[2].ToString();
                    SummaryDocumentsLine_AllowanceCharge.Cs_tag_Amount          = datos[3].ToString();
                    List_SummaryDocumentsLine_AllowanceCharge.Add(SummaryDocumentsLine_AllowanceCharge);
                }
                cs_pxConexion_basedatos.Close();
            }
            catch (Exception ex)
            {
                // System.Windows.Forms.MessageBox.Show(ex.ToString());
                clsBaseMensaje.cs_pxMsgEr("ERR6", ex.ToString());
                clsBaseLog.cs_pxRegistarAdd("clsEntitySummaryDocuments_SummaryDocumentsLine_AllowanceCharge cs_fxObtenerTodoPorCabeceraId" + ex.ToString());
                //return null;
            }
            return(List_SummaryDocumentsLine_AllowanceCharge);
        }
        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());
            }
        }