Página 2 de 2

Re: Duda Plugin JSon

Publicado: 21 Mar 2021 19:15
por abood1987
Agotaras123 escribió:
08 Feb 2021 22:36
el archivo como lo pretendo dejar es como se los muestro a continuación


Código: Seleccionar todo

{
  "declaracion":{
    "general":{
      "rucEmpresa":"",
      "cotizacionUSD":""
    },
    "aduana":{
      "idAduanaIngreso":"0004",
      "idAduanaDespacho":"0004",
      "idDeclaracion":"",
      "fechaAceptDecla":"2021-02-03"
    },
    "importador":{
      "nomImportador":"SUPER TECHNOLOGIES",
      "rtnImportador":"0801-9998-4030",
      "numRegImportador":"08019998470",
      "dirImportador":"FLORENCIA SUR CALLE PRINCIPAL 2",
      "ciuImportador":"TEGUCIGALPA",
      "paisImportador":"HN",
      "telImportador":"22324",
      "faxImportador":"22217",
      "emailImportador":"[email protected]",
      "nivComImportador":"DIS",
      "otrNivComImportador":"N\/A"
    },
    "proveedor":{
      "idProveedor":"SUPER TECHNOLOGIES.",
      "nombre":"SUPER TECHNOLOGIES",
      "direccion":"2200 NW 102ND AVENUE, BAY #6 , FL 33172",
      "ciudad":"MIAMI",
      "pais":"US",
      "telefono":"305-594-2200",
      "fax":"NO TIENE",
      "email":"[email protected]",
      "condComercial":"DT",
      "otraCondicion":"N\/A"
    },
    "intermediario":{
      "nomIntermediario":"",
      "dirIntermediario":"",
      "ciuIntermediario":"",
      "paisIntermediario":"",
      "telIntermediario":"",
      "faxIntermediario":"",
      "emailIntermediario":"",
      "tipoIntermediario":"",
      "otroIntermediario":""
    },
    "transaccion":{
      "lugarEntrega":"MIAMI",
      "paisEntrega":"US",
      "condicionEntrega":"FOB",
      "versionCondicionEntrega":"2020",
      "numContrato":"",
      "fechaContrato":"",
      "formaEnvio":"TT",
      "otrFormaEnvio":"N\/A",
      "indPagoEfectuado":"N",
      "formaPago":"TB",
      "otraFormaPago":"N\/A",
      "lugarEmbarque":"USMIA",
      "paisEmbarque":"US",
      "paisExportacion":"US",
      "fechaExportacion":"2021-01-21",
      "monedaTransaccion":"USD",
      "tipoCambioMonedaTrans":""
    },
    "condiciones":{
      "restricciones":"N",
      "descRestricciones":"",
      "contraPrestacion":"N",
      "descContraPrestacion":"",
      "ventaCondicionada":"N",
      "vinculacionCompVend":"N",
      "tipoVinculacion":"",
      "vincInfluenciaPrecio":"N",
      "pagoDescuentos":"N",
      "conceptoPorPagosDesc":"",
      "existenCanones":"N",
      "razonPago":"",
      "resolAdministrativa":"",
      "fechaResolucion":"",
      "numeroCasillaResol":""
    },
    "determinacion":{
      "importeFactura":"4,690.74",
      "montoPagosInd":"0.00",
      "importeContraprestacion":"0.00",
      "importeReversion":"0.00",
      "gastosComisiones":"0.00",
      "gastosEmbalajes":"0.00",
      "valorMaterialesIncorporados":"0.00",
      "valorHerramientasProd":"0.00",
      "valorMaterialesConsumidos":"0.00",
      "valorIngenieriaExt":"0.00",
      "valorDerLicencia":"0.00",
      "importeTransporte":"512.00",
      "importeCargaManipulacion":"0.00",
      "importeSeguro":"70.36",
      "importeAsistenciaTecnica":"0.00",
      "importeTransportePuerto":"0.00",
      "importeImpuestos":"0.00",
      "importeIntereses":"0.00",
      "importeOtrasDeducciones":"0.00",
      "importeRealPagado":"4,690.74",
      "importeAjustes":"582.36",
      "totalDeducciones":"0.00",
      "valorAduana":"5,273.10"
    },
    "facturas":[
      {
        "informacion":{
          "nroFactura":"987654",
          "fecha":"2020-12-14",
          "totalFlete":"0.00",
          "totalSeguro":"0.00",
          "indProrrateo":false
        },
        "items":[
          {
            "nroItem":"1",
            "cantComercial":"15",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCANE402",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"24.1500",
            "totalFobUnitario":"362.2500",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"2",
            "cantComercial":"35",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN301",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"35.0000",
            "totalFobUnitario":"1,225.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"3",
            "cantComercial":"21",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCANE471",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"37.4400",
            "totalFobUnitario":"786.2400",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"4",
            "cantComercial":"15",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN6810",
            "estadoMercancias":"NU",
            "paisOriMercancias":"TH",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"25.1500",
            "totalFobUnitario":"377.2500",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"5",
            "cantComercial":"40",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"EPSON",
            "modeloMercancias":"PTRCANEPS310",
            "estadoMercancias":"NU",
            "paisOriMercancias":"TH",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"15.5000",
            "totalFobUnitario":"620.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"6",
            "cantComercial":"55",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN2410",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"24.0000",
            "totalFobUnitario":"1,320.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          }
        ]
      }
    ]
  },
  "usuario_id":""
}
Does this mean you mean that the example quoted is the one you want to load in grid?

Re: Duda Plugin JSon

Publicado: 21 Mar 2021 21:57
por abood1987
Yes, I finally understand what you want :dancing: You want a way to deal with JSON Syntax :yes:
I will try to develop a solution when I return from my work after tomorrow :yeah-1417757020:
Wait for me :friends:

Re: Duda Plugin JSon

Publicado: 23 Mar 2021 04:51
por Agotaras123
abood1987 escribió:
21 Mar 2021 21:57
Yes, I finally understand what you want :dancing: You want a way to deal with JSON Syntax :yes:
I will try to develop a solution when I return from my work after tomorrow :yeah-1417757020:
Wait for me :friends:

exacto eso es lo que ocupo esta parte del codigo es lo que esta dentro del Grid
 "facturas":[
      {
        "informacion":{
          "nroFactura":"987654",
          "fecha":"2020-12-14",
          "totalFlete":"0.00",
          "totalSeguro":"0.00",
          "indProrrateo":false
        },
        "items":[
          {
            "nroItem":"1",
            "cantComercial":"15",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCANE402",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"24.1500",
            "totalFobUnitario":"362.2500",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"2",
            "cantComercial":"35",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN301",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"35.0000",
            "totalFobUnitario":"1,225.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"3",
            "cantComercial":"21",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCANE471",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"37.4400",
            "totalFobUnitario":"786.2400",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"4",
            "cantComercial":"15",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN6810",
            "estadoMercancias":"NU",
            "paisOriMercancias":"TH",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"25.1500",
            "totalFobUnitario":"377.2500",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"5",
            "cantComercial":"40",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"EPSON",
            "modeloMercancias":"PTRCANEPS310",
            "estadoMercancias":"NU",
            "paisOriMercancias":"TH",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"15.5000",
            "totalFobUnitario":"620.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          },
          {
            "nroItem":"6",
            "cantComercial":"55",
            "uniComercial":"18",
            "designacionComercial":"IMPRESORAS ",
            "caracteristicasMercancias":"MULTIFUNCIONALES",
            "marcaMercancias":"CANON",
            "modeloMercancias":"PTRCAN2410",
            "estadoMercancias":"NU",
            "paisOriMercancias":"VN",
            "posArancelaria":"8443.31.00.00.00",
            "precioUnitario":"24.0000",
            "totalFobUnitario":"1,320.0000",
            "importeFlete":"0.00",
            "importeSeguro":"0.00",
            "importeOtrosGastos":"0.00",
            "errors":{}
          }
        ]
      }
    ]
  },
es lo que ocupo entender como hacerlo porque no doy con una solucion.

Re: Duda Plugin JSon

Publicado: 23 Mar 2021 11:06
por Dow Sher
Si entendi bien, esto es lo que quieres?
Agrega esto en Global Functions e intenta usarlo. Retorna un string con el JSON
Grid.ToJSON = function (objectName)
  local keyNames = {};
  local gridData = {};
  
  for columnIndex = 1, Grid.GetColumnCount(objectName) do
    local keyName = Grid.GetCellText(objectName, 0, columnIndex-1);
    if string.len(keyName) > 0 then 
      table.insert(keyNames, { keyName, columnIndex-1 });
    end
  end
  
  for rowIndex = 1, Grid.GetRowCount(objectName) - 1 do
    local item = {};
    
    for i, keyName in pairs(keyNames) do
      local keyNameText, columnIndex = keyName[1], keyName[2];
      item[keyNameText] = Grid.GetCellText(objectName, rowIndex, columnIndex);
    end
    
    gridData[rowIndex] = item;
  end
  
  return JSON.Encode(gridData), gridData;
end

Re: Duda Plugin JSon

Publicado: 23 Mar 2021 19:56
por abood1987
This is a small temporary example :
HIDE: ON
Hidebb Message Hidden Description


I will see more what I can get to in succession

Re: Duda Plugin JSon

Publicado: 23 Mar 2021 23:16
por abood1987
Another example:

HIDE: ON
Hidebb Message Hidden Description

Re: Duda Plugin JSon

Publicado: 23 Mar 2021 23:21
por abood1987
So far all of the above is only one table dealing with JSon :pc:
and The table is written as text with “” or [[]] or '' :pc:

Let's try to have it work with more than one table :pc:

Re: Duda Plugin JSon

Publicado: 24 Mar 2021 09:09
por abood1987
Another example:

HIDE: ON
Hidebb Message Hidden Description


Do we walk in how things "JSON" are going? :)

Re: Duda Plugin JSon

Publicado: 02 Abr 2021 04:05
por Agotaras123
Dow Sher escribió:
23 Mar 2021 11:06
Si entendi bien, esto es lo que quieres?
Agrega esto en Global Functions e intenta usarlo. Retorna un string con el JSON
Grid.ToJSON = function (objectName)
  local keyNames = {};
  local gridData = {};
  
  for columnIndex = 1, Grid.GetColumnCount(objectName) do
    local keyName = Grid.GetCellText(objectName, 0, columnIndex-1);
    if string.len(keyName) > 0 then 
      table.insert(keyNames, { keyName, columnIndex-1 });
    end
  end
  
  for rowIndex = 1, Grid.GetRowCount(objectName) - 1 do
    local item = {};
    
    for i, keyName in pairs(keyNames) do
      local keyNameText, columnIndex = keyName[1], keyName[2];
      item[keyNameText] = Grid.GetCellText(objectName, rowIndex, columnIndex);
    end
    
    gridData[rowIndex] = item;
  end
  
  return JSON.Encode(gridData), gridData;
end

Esta funcion esta genial solo que me agrega mucas \\ a e contenido cuando lo reviso en esta web para verificar la calidad me dice que esta erróneo el codigo json

http://jsoneditoronline.org/