<?php

if (isset($_SERVER['HTTP_ORIGIN'])) {
    header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
    header('Access-Control-Allow-Credentials: true');
    header('Access-Control-Max-Age: 86400'); // cache for 1 day
}

error_reporting(E_ERROR | E_PARSE);

$database = $_POST['dbname'];
//$database = $_GET['dbname'];
$jsona = $_POST['datos'];

include 'conn.php';
include 'funciones.php';

//$json = '{"suc_id":1,"ci_op_estacion":1,"tipo":"x","ci_op_num_corre":20,"ci_op_fecha":"2017/3/8  8:20:22","numeroini":330,"numerofin":331,"numeroinidev":275,"numerofindev":276,"abierto":"false","ci_op_fechaf":"2017/3/8  8:20:55","ci_vta_bruto":200,"ci_dev_bruto":-55.56,"ci_fin_bruto":144.44,"ci_vta_desc":0,"ci_dev_desc":-13.89,"ci_fin_desc":-13.89,"ci_vta_neta":200,"ci_dev_neta":-41.67,"ci_fin_neta":158.33,"ci_vta_imp":14,"ci_dev_imp":-2.92,"ci_fin_imp":11.08,"ci_vtas_tot1":214,"ci_dev_tot1":-44.59,"ci_fin_tot1":169.41,"ci_vtas_man":0,"ci_dev_man":0,"ci_fin_man":0,"ci_vta_flet":0,"ci_dev_flet":0,"ci_fin_flet":0,"ci_vta_seg":0,"ci_dev_seg":0,"ci_fin_seg":0,"ci_vtas_tot2":214,"ci_dev_tot2":-44.59,"ci_fin_tot2":169.41,"ci_vta_cont":214,"ci_dev_cont":-44.59,"ci_vta_cre":0,"ci_dev_cre":0,"u_id":0,"op_observ":"null","ci_op_costo":0,"ci_op_contado":169.41,"ci_op_contado_retap":0,"ci_op_credito":0,"ci_op_credito_retap":0,"ci_op_pagado":0,"ci_op_vuelto":0,"ci_op_utilidad":0,"op_utilidadporc":0,"numerof_ini":"000000330","numerof_fin":"0","monto_apertura":500,"entradas":10,"salidas":0,"base1":158.32999999999998,"imp1":11.0831,"total1":169.4131,"base0":0,"imp0":0,"total0":0,"base2":0,"imp2":0,"total2":0,"base3":0,"imp3":0,"total3":0,"no_control":"null","totalencaja":50,"totalturno":669.41,"totaldifere":-619.41,"gran_total_ant":0,"gran_total_dev":-44.59,"gran_total_fac":214,"gran_total":169.41,"numeroxini":0,"numeroxfin":0,"fact_emit":0,"devo_emit":0,"apar_emit":0,"control_inicio":330,"numerof_inidev":"000000275","numerof_findev":"null","base4":0,"imp4":0,"total4":0,"ci_vta_fp1":50,"ci_dev_fp1":0,"ci_fin_fp1":50,"ci_vta_fp2":164,"ci_dev_fp2":-44.59,"ci_fin_fp2":119.41,"ci_vta_fp3":0,"ci_dev_fp3":0,"ci_fin_fp3":0,"ci_vta_fp4":0,"ci_dev_fp4":0,"ci_fin_fp4":0,"ci_vta_fp5":0,"ci_dev_fp5":0,"ci_fin_fp5":0,"ci_vta_fp6":0,"ci_dev_fp6":0,"ci_fin_fp6":0,"ci_vta_fp7":0,"ci_dev_fp7":0,"ci_fin_fp7":0,"ci_vta_fp8":0,"ci_dev_fp8":0,"ci_fin_fp8":0,"ci_vta_fp9":0,"ci_dev_fp9":0,"ci_fin_fp9":0,"ci_vta_fp10":0,"ci_dev_fp10":0,"ci_fin_fp10":0,"ci_vta_fp11":0,"ci_dev_fp11":0,"ci_fin_fp11":0,"ci_vta_fp12":0,"ci_dev_fp12":0,"ci_fin_fp12":0,"ci_vta_fp13":0,"ci_dev_fp13":0,"ci_fin_fp13":0,"ci_vta_fp14":0,"ci_dev_fp14":0,"ci_fin_fp14":0,"ci_vta_fp15":0,"ci_dev_fp15":0,"ci_fin_fp15":0,"ci_vta_fp16":0,"ci_dev_fp16":0,"ci_fin_fp16":0,"ci_vta_fp17":0,"ci_dev_fp17":0,"ci_fin_fp17":0,"ci_vta_fp18":0,"ci_dev_fp18":0,"ci_fin_fp18":0,"ci_vta_fp19":0,"ci_dev_fp19":0,"ci_fin_fp19":0,"ci_vta_fp20":0,"ci_dev_fp20":0,"ci_fin_fp20":0,"ci_vta_otro":0,"ci_dev_otro":0,"ci_fin_otro":0,"trig_unic":"1-1-20x","op_num_nco":"0","mon_op":"1","mon_taza_op":1,"mon_id1":"1","mon_taza1":1,"mon_id2":"1","mon_taza2":1,"mon_id3":"1","mon_taza3":1,"usermodify":1,"useroption":0,"syncprocesing":0,"op_abonos":0,"op_apartados":0,"op_certificados":0,"tot_vta_efec":50,"tot_vta_cheq":119.41,"tot_vta_tard":0,"tot_vta_tarc":0,"tot_vta_cert":0,"tot_vta_cred":0,"tot_vta_otro":0,"tot_vta_fin":169.41,"abn_ct_efec":0,"abn_ct_cheq":0,"abn_ct_tard":0,"abn_ct_tarc":0,"abn_ct_cred":0,"abn_ct_otro":0,"abn_ct_fin":0,"abn_ap_efec":0,"abn_ap_cheq":0,"abn_ap_tard":0,"abn_ap_tarc":0,"abn_ap_cred":0,"abn_ap_otro":0,"abn_ap_fin":0,"abn_ce_efec":0,"abn_ce_cheq":0,"abn_ce_tard":0,"abn_ce_tarc":0,"abn_ce_cred":0,"abn_ce_otro":0,"abn_ce_fin":0,"ent_sal_efec":0,"ent_sal_cheq":0,"ent_sal_tard":0,"ent_sal_tarc":0,"ent_sal_man":0,"ent_sal_fin":0,"tot_pag_efec":0,"tot_pag_cheq":0,"tot_pag_tard":0,"tot_pag_tarc":0,"tot_pag_cred":0,"tot_pag_otro":0,"tot_pag_fin":0,"ci_op_fechaf_fis":"null","ci_op_idz":"null"}';

//$jsona = '{"suc_id":1,"ci_op_estacion":1,"tipo":"x","ci_op_num_corre":20,"ci_op_fecha":"2017/3/8  8:20:22","numeroini":330,"numerofin":331,"numeroinidev":275,"numerofindev":276,"abierto":"false","ci_op_fechaf":"2017/3/8  8:20:55","ci_vta_bruto":200,"ci_dev_bruto":-55.56,"ci_fin_bruto":144.44,"ci_vta_desc":0,"ci_dev_desc":-13.89,"ci_fin_desc":-13.89,"ci_vta_neta":200,"ci_dev_neta":-41.67,"ci_fin_neta":158.33,"ci_vta_imp":14,"ci_dev_imp":-2.92,"ci_fin_imp":11.08,"ci_vtas_tot1":214,"ci_dev_tot1":-44.59,"ci_fin_tot1":169.41,"ci_vtas_man":0,"ci_dev_man":0,"ci_fin_man":0,"ci_vta_flet":0,"ci_dev_flet":0,"ci_fin_flet":0,"ci_vta_seg":0,"ci_dev_seg":0,"ci_fin_seg":0,"ci_vtas_tot2":214,"ci_dev_tot2":-44.59,"ci_fin_tot2":169.41,"ci_vta_cont":214,"ci_dev_cont":-44.59,"ci_vta_cre":0,"ci_dev_cre":0,"u_id":0,"op_observ":"null","ci_op_costo":0,"ci_op_contado":169.41,"ci_op_contado_retap":0,"ci_op_credito":0,"ci_op_credito_retap":0,"ci_op_pagado":0,"ci_op_vuelto":0,"ci_op_utilidad":0,"op_utilidadporc":0,"numerof_ini":"000000330","numerof_fin":"0","monto_apertura":500,"entradas":10,"salidas":0,"base1":158.32999999999998,"imp1":11.0831,"total1":169.4131,"base0":0,"imp0":0,"total0":0,"base2":0,"imp2":0,"total2":0,"base3":0,"imp3":0,"total3":0,"no_control":"null","totalencaja":50,"totalturno":669.41,"totaldifere":-619.41,"gran_total_ant":0,"gran_total_dev":-44.59,"gran_total_fac":214,"gran_total":169.41,"numeroxini":0,"numeroxfin":0,"fact_emit":0,"devo_emit":0,"apar_emit":0,"control_inicio":330,"numerof_inidev":"000000275","numerof_findev":"null","base4":0,"imp4":0,"total4":0,"ci_vta_fp1":50,"ci_dev_fp1":0,"ci_fin_fp1":50,"ci_vta_fp2":164,"ci_dev_fp2":-44.59,"ci_fin_fp2":119.41,"ci_vta_fp3":0,"ci_dev_fp3":0,"ci_fin_fp3":0,"ci_vta_fp4":0,"ci_dev_fp4":0,"ci_fin_fp4":0,"ci_vta_fp5":0,"ci_dev_fp5":0,"ci_fin_fp5":0,"ci_vta_fp6":0,"ci_dev_fp6":0,"ci_fin_fp6":0,"ci_vta_fp7":0,"ci_dev_fp7":0,"ci_fin_fp7":0,"ci_vta_fp8":0,"ci_dev_fp8":0,"ci_fin_fp8":0,"ci_vta_fp9":0,"ci_dev_fp9":0,"ci_fin_fp9":0,"ci_vta_fp10":0,"ci_dev_fp10":0,"ci_fin_fp10":0,"ci_vta_fp11":0,"ci_dev_fp11":0,"ci_fin_fp11":0,"ci_vta_fp12":0,"ci_dev_fp12":0,"ci_fin_fp12":0,"ci_vta_fp13":0,"ci_dev_fp13":0,"ci_fin_fp13":0,"ci_vta_fp14":0,"ci_dev_fp14":0,"ci_fin_fp14":0,"ci_vta_fp15":0,"ci_dev_fp15":0,"ci_fin_fp15":0,"ci_vta_fp16":0,"ci_dev_fp16":0,"ci_fin_fp16":0,"ci_vta_fp17":0,"ci_dev_fp17":0,"ci_fin_fp17":0,"ci_vta_fp18":0,"ci_dev_fp18":0,"ci_fin_fp18":0,"ci_vta_fp19":0,"ci_dev_fp19":0,"ci_fin_fp19":0,"ci_vta_fp20":0,"ci_dev_fp20":0,"ci_fin_fp20":0,"ci_vta_otro":0,"ci_dev_otro":0,"ci_fin_otro":0,"trig_unic":"1-1-20x","op_num_nco":"0","mon_op":"1","mon_taza_op":1,"mon_id1":"1","mon_taza1":1,"mon_id2":"1","mon_taza2":1,"mon_id3":"1","mon_taza3":1,"usermodify":1,"useroption":0,"syncprocesing":0,"op_abonos":0,"op_apartados":0,"op_certificados":0,"tot_vta_efec":50,"tot_vta_cheq":119.41,"tot_vta_tard":0,"tot_vta_tarc":0,"tot_vta_cert":0,"tot_vta_cred":0,"tot_vta_otro":0,"tot_vta_fin":169.41,"abn_ct_efec":0,"abn_ct_cheq":0,"abn_ct_tard":0,"abn_ct_tarc":0,"abn_ct_cred":0,"abn_ct_otro":0,"abn_ct_fin":0,"abn_ap_efec":0,"abn_ap_cheq":0,"abn_ap_tard":0,"abn_ap_tarc":0,"abn_ap_cred":0,"abn_ap_otro":0,"abn_ap_fin":0,"abn_ce_efec":0,"abn_ce_cheq":0,"abn_ce_tard":0,"abn_ce_tarc":0,"abn_ce_cred":0,"abn_ce_otro":0,"abn_ce_fin":0,"ent_sal_efec":0,"ent_sal_cheq":0,"ent_sal_tard":0,"ent_sal_tarc":0,"ent_sal_man":0,"ent_sal_fin":0,"tot_pag_efec":0,"tot_pag_cheq":0,"tot_pag_tard":0,"tot_pag_tarc":0,"tot_pag_cred":0,"tot_pag_otro":0,"tot_pag_fin":0,"ci_op_fechaf_fis":"null","ci_op_idz":"null"}';

$obj = json_decode($jsona);

$sql = "insert into " . $database . ".cierres_gen_v2 (suc_id,
		 ci_op_estacion,
		 tipo,
		 ci_op_num_corre,
		 ci_op_fecha,
		 numeroini,
		 numerofin,
		 numeroinidev,
		 numerofindev,
		 abierto,
		 ci_op_fechaf,
		 ci_vta_bruto,
		 ci_dev_bruto,
		 ci_fin_bruto,
		 ci_vta_desc,
		 ci_dev_desc,
		 ci_fin_desc,
		 ci_vta_neta,
		 ci_dev_neta,
		 ci_fin_neta,
		 ci_vta_imp,
		 ci_dev_imp,
		 ci_fin_imp,
		 ci_vtas_tot1,
		 ci_dev_tot1,
		 ci_fin_tot1,
		 ci_vtas_man,
		 ci_dev_man,
		 ci_fin_man,
		 ci_vta_flet,
		 ci_dev_flet,
		 ci_fin_flet,
		 ci_vta_seg,
		 ci_dev_seg,
		 ci_fin_seg,
		 ci_vtas_tot2,
		 ci_dev_tot2,
		 ci_fin_tot2,
		 ci_vta_cont,
		 ci_dev_cont,
		 ci_vta_cre,
		 ci_dev_cre,
		 u_id,
		 op_observ,
		 ci_op_costo,
		 ci_op_contado,
		 ci_op_contado_retap,
		 ci_op_credito,
		 ci_op_credito_retap,
		 ci_op_pagado,
		 ci_op_vuelto,
		 ci_op_utilidad,
		 op_utilidadporc,
		 numerof_ini,
		 numerof_fin,
		 monto_apertura,
		 entradas,
		 salidas,
		 base1,
		 imp1,
		 total1,
		 base0,
		 imp0,
		 total0,
		 base2,
		 imp2,
		 total2,
		 base3,
		 imp3,
		 total3,
		 no_control,
		 totalencaja,
		 totalturno,
		 totaldifere,
		 gran_total_ant,
		 gran_total_dev,
		 gran_total_fac,
		 gran_total,
		 numeroxini,
		 numeroxfin,
		 fact_emit,
		 devo_emit,
		 apar_emit,
		 control_inicio,
		 numerof_inidev,
		 numerof_findev,
		 base4,
		 imp4,
		 total4,
		 ci_vta_fp1,
		 ci_dev_fp1,
		 ci_fin_fp1,
		 ci_vta_fp2,
		 ci_dev_fp2,
		 ci_fin_fp2,
		 ci_vta_fp3,
		 ci_dev_fp3,
		 ci_fin_fp3,
		 ci_vta_fp4,
		 ci_dev_fp4,
		 ci_fin_fp4,
		 ci_vta_fp5,
		 ci_dev_fp5,
		 ci_fin_fp5,
		 ci_vta_fp6,
		 ci_dev_fp6,
		 ci_fin_fp6,
		 ci_vta_fp7,
		 ci_dev_fp7,
		 ci_fin_fp7,
		 ci_vta_fp8,
		 ci_dev_fp8,
		 ci_fin_fp8,
		 ci_vta_fp9,
		 ci_dev_fp9,
		 ci_fin_fp9,
		 ci_vta_fp10,
		 ci_dev_fp10,
		 ci_fin_fp10,
		 ci_vta_fp11,
		 ci_dev_fp11,
		 ci_fin_fp11,
		 ci_vta_fp12,
		 ci_dev_fp12,
		 ci_fin_fp12,
		 ci_vta_fp13,
		 ci_dev_fp13,
		 ci_fin_fp13,
		 ci_vta_fp14,
		 ci_dev_fp14,
		 ci_fin_fp14,
		 ci_vta_fp15,
		 ci_dev_fp15,
		 ci_fin_fp15,
		 ci_vta_fp16,
		 ci_dev_fp16,
		 ci_fin_fp16,
		 ci_vta_fp17,
		 ci_dev_fp17,
		 ci_fin_fp17,
		 ci_vta_fp18,
		 ci_dev_fp18,
		 ci_fin_fp18,
		 ci_vta_fp19,
		 ci_dev_fp19,
		 ci_fin_fp19,
		 ci_vta_fp20,
		 ci_dev_fp20,
		 ci_fin_fp20,
		 ci_vta_otro,
		 ci_dev_otro,
		 ci_fin_otro,
		 trig_unic,
		 op_num_nco,
		 mon_op,
		 mon_taza_op,
		 mon_id1,
		 mon_taza1,
		 mon_id2,
		 mon_taza2,
		 mon_id3,
		 mon_taza3,
		 usermodify,
		 useroption,
		 syncprocesing,
		 op_abonos,
		 op_apartados,
		 op_certificados,
		 tot_vta_efec,
		 tot_vta_cheq,
		 tot_vta_tard,
		 tot_vta_tarc,
		 tot_vta_cert,
		 tot_vta_cred,
		 tot_vta_otro,
		 tot_vta_fin,
		 abn_ct_efec,
		 abn_ct_cheq,
		 abn_ct_tard,
		 abn_ct_tarc,
		 abn_ct_cred,
		 abn_ct_otro,
		 abn_ct_fin,
		 abn_ap_efec,
		 abn_ap_cheq,
		 abn_ap_tard,
		 abn_ap_tarc,
		 abn_ap_cred,
		 abn_ap_otro,
		 abn_ap_fin,
		 abn_ce_efec,
		 abn_ce_cheq,
		 abn_ce_tard,
		 abn_ce_tarc,
		 abn_ce_cred,
		 abn_ce_otro,
		 abn_ce_fin,
		 ent_sal_efec,
		 ent_sal_cheq,
		 ent_sal_tard,
		 ent_sal_tarc,
		 ent_sal_man,
		 ent_sal_fin,
		 tot_pag_efec,
		 tot_pag_cheq,
		 tot_pag_tard,
		 tot_pag_tarc,
		 tot_pag_cred,
		 tot_pag_otro,
		 tot_pag_fin,
		 ci_op_fechaf_fis,
		 ci_op_idz) values('" .
$obj->{'suc_id'} . "', '" .
$obj->{'ci_op_estacion'} . "', '" .
$obj->{'tipo'} . "', '" .
$obj->{'ci_op_num_corre'} . "', '" .
$obj->{'ci_op_fecha'} . "', '" .
$obj->{'numeroini'} . "', '" .
$obj->{'numerofin'} . "', '" .
$obj->{'numeroinidev'} . "', '" .
$obj->{'numerofindev'} . "', '" .
$obj->{'abierto'} . "', '" .
$obj->{'ci_op_fechaf'} . "', '" .
$obj->{'ci_vta_bruto'} . "', '" .
$obj->{'ci_dev_bruto'} . "', '" .
$obj->{'ci_fin_bruto'} . "', '" .
$obj->{'ci_vta_desc'} . "', '" .
$obj->{'ci_dev_desc'} . "', '" .
$obj->{'ci_fin_desc'} . "', '" .
$obj->{'ci_vta_neta'} . "', '" .
$obj->{'ci_dev_neta'} . "', '" .
$obj->{'ci_fin_neta'} . "', '" .
$obj->{'ci_vta_imp'} . "', '" .
$obj->{'ci_dev_imp'} . "', '" .
$obj->{'ci_fin_imp'} . "', '" .
$obj->{'ci_vtas_tot1'} . "', '" .
$obj->{'ci_dev_tot1'} . "', '" .
$obj->{'ci_fin_tot1'} . "', '" .
$obj->{'ci_vtas_man'} . "', '" .
$obj->{'ci_dev_man'} . "', '" .
$obj->{'ci_fin_man'} . "', '" .
$obj->{'ci_vta_flet'} . "', '" .
$obj->{'ci_dev_flet'} . "', '" .
$obj->{'ci_fin_flet'} . "', '" .
$obj->{'ci_vta_seg'} . "', '" .
$obj->{'ci_dev_seg'} . "', '" .
$obj->{'ci_fin_seg'} . "', '" .
$obj->{'ci_vtas_tot2'} . "', '" .
$obj->{'ci_dev_tot2'} . "', '" .
$obj->{'ci_fin_tot2'} . "', '" .
$obj->{'ci_vta_cont'} . "', '" .
$obj->{'ci_dev_cont'} . "', '" .
$obj->{'ci_vta_cre'} . "', '" .
$obj->{'ci_dev_cre'} . "', '" .
$obj->{'u_id'} . "', '" .
$obj->{'op_observ'} . "', '" .
$obj->{'ci_op_costo'} . "', '" .
$obj->{'ci_op_contado'} . "', '" .
$obj->{'ci_op_contado_retap'} . "', '" .
$obj->{'ci_op_credito'} . "', '" .
$obj->{'ci_op_credito_retap'} . "', '" .
$obj->{'ci_op_pagado'} . "', '" .
$obj->{'ci_op_vuelto'} . "', '" .
$obj->{'ci_op_utilidad'} . "', '" .
$obj->{'op_utilidadporc'} . "', '" .
$obj->{'numerof_ini'} . "', '" .
$obj->{'numerof_fin'} . "', '" .
$obj->{'monto_apertura'} . "', '" .
$obj->{'entradas'} . "', '" .
$obj->{'salidas'} . "', '" .
$obj->{'base1'} . "', '" .
$obj->{'imp1'} . "', '" .
$obj->{'total1'} . "', '" .
$obj->{'base0'} . "', '" .
$obj->{'imp0'} . "', '" .
$obj->{'total0'} . "', '" .
$obj->{'base2'} . "', '" .
$obj->{'imp2'} . "', '" .
$obj->{'total2'} . "', '" .
$obj->{'base3'} . "', '" .
$obj->{'imp3'} . "', '" .
$obj->{'total3'} . "', " .
$obj->{'no_control'} . ", '" .
$obj->{'totalencaja'} . "', '" .
$obj->{'totalturno'} . "', '" .
$obj->{'totaldifere'} . "', '" .
$obj->{'gran_total_ant'} . "', '" .
$obj->{'gran_total_dev'} . "', '" .
$obj->{'gran_total_fac'} . "', '" .
$obj->{'gran_total'} . "', '" .
$obj->{'numeroxini'} . "', '" .
$obj->{'numeroxfin'} . "', '" .
$obj->{'fact_emit'} . "', '" .
$obj->{'devo_emit'} . "', '" .
$obj->{'apar_emit'} . "', '" .
$obj->{'control_inicio'} . "', '" .
$obj->{'numerof_inidev'} . "', " .
$obj->{'numerof_findev'} . ", '" .
$obj->{'base4'} . "', '" .
$obj->{'imp4'} . "', '" .
$obj->{'total4'} . "', '" .
$obj->{'ci_vta_fp1'} . "', '" .
$obj->{'ci_dev_fp1'} . "', '" .
$obj->{'ci_fin_fp1'} . "', '" .
$obj->{'ci_vta_fp2'} . "', '" .
$obj->{'ci_dev_fp2'} . "', '" .
$obj->{'ci_fin_fp2'} . "', '" .
$obj->{'ci_vta_fp3'} . "', '" .
$obj->{'ci_dev_fp3'} . "', '" .
$obj->{'ci_fin_fp3'} . "', '" .
$obj->{'ci_vta_fp4'} . "', '" .
$obj->{'ci_dev_fp4'} . "', '" .
$obj->{'ci_fin_fp4'} . "', '" .
$obj->{'ci_vta_fp5'} . "', '" .
$obj->{'ci_dev_fp5'} . "', '" .
$obj->{'ci_fin_fp5'} . "', '" .
$obj->{'ci_vta_fp6'} . "', '" .
$obj->{'ci_dev_fp6'} . "', '" .
$obj->{'ci_fin_fp6'} . "', '" .
$obj->{'ci_vta_fp7'} . "', '" .
$obj->{'ci_dev_fp7'} . "', '" .
$obj->{'ci_fin_fp7'} . "', '" .
$obj->{'ci_vta_fp8'} . "', '" .
$obj->{'ci_dev_fp8'} . "', '" .
$obj->{'ci_fin_fp8'} . "', '" .
$obj->{'ci_vta_fp9'} . "', '" .
$obj->{'ci_dev_fp9'} . "', '" .
$obj->{'ci_fin_fp9'} . "', '" .
$obj->{'ci_vta_fp10'} . "', '" .
$obj->{'ci_dev_fp10'} . "', '" .
$obj->{'ci_fin_fp10'} . "', '" .
$obj->{'ci_vta_fp11'} . "', '" .
$obj->{'ci_dev_fp11'} . "', '" .
$obj->{'ci_fin_fp11'} . "', '" .
$obj->{'ci_vta_fp12'} . "', '" .
$obj->{'ci_dev_fp12'} . "', '" .
$obj->{'ci_fin_fp12'} . "', '" .
$obj->{'ci_vta_fp13'} . "', '" .
$obj->{'ci_dev_fp13'} . "', '" .
$obj->{'ci_fin_fp13'} . "', '" .
$obj->{'ci_vta_fp14'} . "', '" .
$obj->{'ci_dev_fp14'} . "', '" .
$obj->{'ci_fin_fp14'} . "', '" .
$obj->{'ci_vta_fp15'} . "', '" .
$obj->{'ci_dev_fp15'} . "', '" .
$obj->{'ci_fin_fp15'} . "', '" .
$obj->{'ci_vta_fp16'} . "', '" .
$obj->{'ci_dev_fp16'} . "', '" .
$obj->{'ci_fin_fp16'} . "', '" .
$obj->{'ci_vta_fp17'} . "', '" .
$obj->{'ci_dev_fp17'} . "', '" .
$obj->{'ci_fin_fp17'} . "', '" .
$obj->{'ci_vta_fp18'} . "', '" .
$obj->{'ci_dev_fp18'} . "', '" .
$obj->{'ci_fin_fp18'} . "', '" .
$obj->{'ci_vta_fp19'} . "', '" .
$obj->{'ci_dev_fp19'} . "', '" .
$obj->{'ci_fin_fp19'} . "', '" .
$obj->{'ci_vta_fp20'} . "', '" .
$obj->{'ci_dev_fp20'} . "', '" .
$obj->{'ci_fin_fp20'} . "', '" .
$obj->{'ci_vta_otro'} . "', '" .
$obj->{'ci_dev_otro'} . "', '" .
$obj->{'ci_fin_otro'} . "', '" .
$obj->{'trig_unic'} . "', '" .
$obj->{'op_num_nco'} . "', '" .
$obj->{'mon_op'} . "', '" .
$obj->{'mon_taza_op'} . "', '" .
$obj->{'mon_id1'} . "', '" .
$obj->{'mon_taza1'} . "', '" .
$obj->{'mon_id2'} . "', '" .
$obj->{'mon_taza2'} . "', '" .
$obj->{'mon_id3'} . "', '" .
$obj->{'mon_taza3'} . "', '" .
$obj->{'usermodify'} . "', '" .
$obj->{'useroption'} . "', '" .
$obj->{'syncprocesing'} . "', '" .
$obj->{'op_abonos'} . "', '" .
$obj->{'op_apartados'} . "', '" .
$obj->{'op_certificados'} . "', '" .
$obj->{'tot_vta_efec'} . "', '" .
$obj->{'tot_vta_cheq'} . "', '" .
$obj->{'tot_vta_tard'} . "', '" .
$obj->{'tot_vta_tarc'} . "', '" .
$obj->{'tot_vta_cert'} . "', '" .
$obj->{'tot_vta_cred'} . "', '" .
$obj->{'tot_vta_otro'} . "', '" .
$obj->{'tot_vta_fin'} . "', '" .
$obj->{'abn_ct_efec'} . "', '" .
$obj->{'abn_ct_cheq'} . "', '" .
$obj->{'abn_ct_tard'} . "', '" .
$obj->{'abn_ct_tarc'} . "', '" .
$obj->{'abn_ct_cred'} . "', '" .
$obj->{'abn_ct_otro'} . "', '" .
$obj->{'abn_ct_fin'} . "', '" .
$obj->{'abn_ap_efec'} . "', '" .
$obj->{'abn_ap_cheq'} . "', '" .
$obj->{'abn_ap_tard'} . "', '" .
$obj->{'abn_ap_tarc'} . "', '" .
$obj->{'abn_ap_cred'} . "', '" .
$obj->{'abn_ap_otro'} . "', '" .
$obj->{'abn_ap_fin'} . "', '" .
$obj->{'abn_ce_efec'} . "', '" .
$obj->{'abn_ce_cheq'} . "', '" .
$obj->{'abn_ce_tard'} . "', '" .
$obj->{'abn_ce_tarc'} . "', '" .
$obj->{'abn_ce_cred'} . "', '" .
$obj->{'abn_ce_otro'} . "', '" .
$obj->{'abn_ce_fin'} . "', '" .
$obj->{'ent_sal_efec'} . "', '" .
$obj->{'ent_sal_cheq'} . "', '" .
$obj->{'ent_sal_tard'} . "', '" .
$obj->{'ent_sal_tarc'} . "', '" .
$obj->{'ent_sal_man'} . "', '" .
$obj->{'ent_sal_fin'} . "', '" .
$obj->{'tot_pag_efec'} . "', '" .
$obj->{'tot_pag_cheq'} . "', '" .
$obj->{'tot_pag_tard'} . "', '" .
$obj->{'tot_pag_tarc'} . "', '" .
$obj->{'tot_pag_cred'} . "', '" .
$obj->{'tot_pag_otro'} . "', '" .
$obj->{'tot_pag_fin'} . "', " .
$obj->{'ci_op_fechaf_fis'} . ", " .
$obj->{'ci_op_idz'} . ")";

//print($sql);

$qur = $connection->query($sql);

$procesado = 0;
$sql1 = "select null from " . $database . ".cierres_gen_v2 where tipo ='" . $obj->{'tipo'} . "' and ci_op_num_corre =" . $obj->{'ci_op_num_corre'} .
" and suc_id =" . $obj->{'suc_id'} . " and ci_op_estacion=" . $obj->{'ci_op_estacion'};

$qur1 = $connection->query($sql1);

if ($_SESSION['codigo'] == "99") {

    $json->datos = "false";

} else {

    $json->datos = "true";
}
$jsonTempData1 = array();
$jsonTempData1['procesado'] = 0;

while ($r = mysqli_fetch_assoc($qur1)) {

    $jsonTempData1['procesado'] = 1;

}

$jsonData1[] = $jsonTempData1;
$json->Proc = $jsonData1;

print_r(json_encode($json));

$qur = null;
$qur1 = null;
@mysqli_close($connection);
?>