Fix cabecera and other 1 dimension json being generated as arrays of 1 json.
Standardize all to jsonb instead of json. FACTURADOR APP can now process the output of the query without manual editions to the json file.
This commit is contained in:
		
							parent
							
								
									01d4fdbdcf
								
							
						
					
					
						commit
						b2a42659b9
					
				| 
						 | 
				
			
			@ -62,7 +62,7 @@ ad_client.name ='BLB'
 | 
			
		|||
select
 | 
			
		||||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'cabecera', json_agg(DISTINCT
 | 
			
		||||
		'cabecera', jsonb_agg(DISTINCT
 | 
			
		||||
			jsonb_build_object(
 | 
			
		||||
				'ivoiceid',c_invoice_id,
 | 
			
		||||
				'tipOperacion','0101',
 | 
			
		||||
| 
						 | 
				
			
			@ -83,11 +83,11 @@ select
 | 
			
		|||
				'ublVersionId','2.1',
 | 
			
		||||
				'customizationId','2.0'
 | 
			
		||||
				)
 | 
			
		||||
			)
 | 
			
		||||
			)->0
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'adicionalCabecera', json_agg(DISTINCT
 | 
			
		||||
		'adicionalCabecera', jsonb_agg(DISTINCT
 | 
			
		||||
			jsonb_build_object(
 | 
			
		||||
				'invoiceid',c_invoice_id,
 | 
			
		||||
				'codPaisCliente','PE',
 | 
			
		||||
| 
						 | 
				
			
			@ -97,11 +97,11 @@ select
 | 
			
		|||
				'codUbigeoEntrega','150140',
 | 
			
		||||
				'desDireccionEntrega','AV. ANGAMOS 1111, SURCO, LIMA'
 | 
			
		||||
				)
 | 
			
		||||
			)
 | 
			
		||||
			)->0
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'detalle', json_agg(DISTINCT
 | 
			
		||||
		'detalle', jsonb_agg(DISTINCT
 | 
			
		||||
			jsonb_build_object(
 | 
			
		||||
				'invoiceline',c_invoiceline_id,
 | 
			
		||||
				'codUnidadMedida','BX',
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +150,7 @@ select
 | 
			
		|||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'adicionalDetalle','[]'::json
 | 
			
		||||
		'adicionalDetalle','[]'::jsonb
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
| 
						 | 
				
			
			@ -175,11 +175,11 @@ select
 | 
			
		|||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'relacionados','[]'::json
 | 
			
		||||
		'relacionados','[]'::jsonb
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
		'variablesGlobales','[]'::json
 | 
			
		||||
		'variablesGlobales','[]'::jsonb
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
| 
						 | 
				
			
			@ -189,7 +189,7 @@ select
 | 
			
		|||
				'mtoNetoPendientePago',grandtotal::varchar,
 | 
			
		||||
				'tipMonedaMtoNetoPendientePago',iso_code
 | 
			
		||||
				)
 | 
			
		||||
			)
 | 
			
		||||
			)->0
 | 
			
		||||
		)
 | 
			
		||||
		||
 | 
			
		||||
	jsonb_build_object(
 | 
			
		||||
| 
						 | 
				
			
			@ -210,7 +210,7 @@ select
 | 
			
		|||
				'porRetencion','0.00',
 | 
			
		||||
				'impRetencion','0.00'
 | 
			
		||||
				)
 | 
			
		||||
			)
 | 
			
		||||
			)->0
 | 
			
		||||
		)
 | 
			
		||||
 | 
			
		||||
--*/
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue