Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 1475 |
|
1.05% |
1 / 95 |
CRAP | n/a |
0 / 0 |
|
| get_date_spanish | |
0.00% |
0 / 28 |
|
0.00% |
0 / 1 |
132 | |||
| echonf | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| BoldaString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| EstilizaCampo | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
20 | |||
| isValueonArray | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
72 | |||
| doOperation | |
0.00% |
0 / 127 |
|
0.00% |
0 / 1 |
5852 | |||
| generaArraydeunaColumna | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
42 | |||
| arrayCopy | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
30 | |||
| quitaespaciosintermedios | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| arrayMovetoTop | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| arrayMovetoBottom | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| diferenciadeTiempo | |
0.00% |
0 / 28 |
|
0.00% |
0 / 1 |
90 | |||
| limpiaCantidad | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| limpiaCantidad_ | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| vx_trim | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| sanitizeString | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| quitaacentos | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| fechaMaxima | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
20 | |||
| sanitizeFileName | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| filtraArray | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
110 | |||
| concatena | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| deleteDirectory | |
0.00% |
0 / 26 |
|
0.00% |
0 / 1 |
420 | |||
| isWeekend | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| sumaDias | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| acentostoupper | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
2 | |||
| htmltoupper | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| quitacaracraros | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
56 | |||
| arrayEstado | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
210 | |||
| estado2Html | |
0.00% |
0 / 29 |
|
0.00% |
0 / 1 |
110 | |||
| compara2Arrays | |
0.00% |
0 / 31 |
|
0.00% |
0 / 1 |
182 | |||
| txtHaceCuantoTiempo | |
0.00% |
0 / 29 |
|
0.00% |
0 / 1 |
156 | |||
| startsWith | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| endsWith | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| getDateLabel | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
132 | |||
| valida_carpetas | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
72 | |||
| hayIgual | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 | |||
| conFin | |
0.00% |
0 / 30 |
|
0.00% |
0 / 1 |
210 | |||
| comparaStrings | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| comparaArrays | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| limpiaTagsdeRemarks | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| calculaPagina2Reg | |
0.00% |
0 / 21 |
|
0.00% |
0 / 1 |
90 | |||
| send_mail | |
0.00% |
0 / 35 |
|
0.00% |
0 / 1 |
6 | |||
| jsonFile | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
6 | |||
| dd_ | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
12 | |||
| v_d | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| renderView | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
6 | |||
| includeView | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| hex2rgb | |
0.00% |
0 / 16 |
|
0.00% |
0 / 1 |
56 | |||
| indexa_ | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| obtenNumeroRevisorGastosCuentaT | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| obtenNumeroRevisorMovimientosBanco | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| obtenEstadoRevisorGastosCuentaT | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| obtenEstadoRevisorMovimientosBanco | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| obtenEstadoRevisorGastosCuentaTPermission | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| obtenEstadoRevisorMovimientosBancoPermission | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| obtenPosicionesRevisor | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
12 | |||
| calculaSemaforo | |
0.00% |
0 / 44 |
|
0.00% |
0 / 1 |
756 | |||
| quiesnEsSupervisor | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| asignacion_2_html | |
0.00% |
0 / 86 |
|
0.00% |
0 / 1 |
1640 | |||
| async_all | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
2 | |||
| fechaMysql2JS | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
42 | |||
| cmSelectValues | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| activa_errores | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| getTabsToAssignments | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
56 | |||
| getDivsToAssignments | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
110 | |||
| getLinksToAssignments | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
72 | |||
| traeSupervisoresyRevisores | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| traeSupervisoresRevisores | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
30 | |||
| getTableSupervisorsReviewers | |
0.00% |
0 / 95 |
|
0.00% |
0 / 1 |
1482 | |||
| getTableSupervisorsReviewers_2 | |
0.00% |
0 / 104 |
|
0.00% |
0 / 1 |
2256 | |||
| getPosEstado | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
6 | |||
| parseClauseIn | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| calculaEstadoDispobible | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
30 | |||
| haz_update | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
| countUserEstado | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| tieneGastosPorRevisar | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| getMinimumAssignmentDate | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| dateDifference | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| objetivisa_ | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| normaliza_ | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| obten_array_norm_doctos | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| obten_sql_norm_doctos | |
0.00% |
0 / 12 |
|
0.00% |
0 / 1 |
72 | |||
| delete_from_links_al_banco_live | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| insert_update_links_al_banco_live | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| normaliza_origen_doctos | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| spanAlertMovimientosConWarning | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
12 | |||
| estadosBodega2Html | |
0.00% |
0 / 41 |
|
0.00% |
0 / 1 |
90 | |||
| array2jsArray | |
0.00% |
0 / 14 |
|
0.00% |
0 / 1 |
56 | |||
| bodega_id_select | |
0.00% |
0 / 24 |
|
0.00% |
0 / 1 |
110 | |||
| cuentat_es_de | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
| createHtmlForTabBodegaUsuario | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
6 | |||
| getHtmlTabBodega | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
3906 | |||
| addAfterKey | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| getDocparaVale | |
0.00% |
0 / 116 |
|
0.00% |
0 / 1 |
1122 | |||
| obten_remarks_banco_cuenta_trans | |
0.00% |
0 / 41 |
|
0.00% |
0 / 1 |
132 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * get_date_spanish() |
| 4 | * |
| 5 | * @param mixed $time |
| 6 | * @param bool $part |
| 7 | * @param string $formatDate |
| 8 | * @return |
| 9 | */ |
| 10 | function get_date_spanish($time, $part = false, $formatDate = '', $formatMonth='month', $formatDayWeek='', $formatYear='Y') |
| 11 | { |
| 12 | $time = empty($time) ? strtotime("now") : $time; |
| 13 | |
| 14 | $month = array("","enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiempre", "octubre", "noviembre", "diciembre"); |
| 15 | $month_execute = "n"; |
| 16 | |
| 17 | $month_mini = array("","ENE", "FEB", "MAR", "ABR", "MAY", "JUN", "JUL", "AGO", "SEP", "OCT", "NOV", "DIC"); |
| 18 | $month_mini_execute = "n"; |
| 19 | |
| 20 | $day = array("domingo","lunes","martes","miércoles","jueves","viernes","sábado"); |
| 21 | $day_execute = "w"; |
| 22 | |
| 23 | $day_mini = array("DOM","LUN","MAR","MIE","JUE","VIE","SAB"); |
| 24 | $day_mini_execute = "w"; |
| 25 | |
| 26 | |
| 27 | |
| 28 | $print_hoy = array("month"=>"month", "month_mini"=>"month_mini"); |
| 29 | |
| 30 | if( $part === false ) |
| 31 | { |
| 32 | $strMonth = ''; |
| 33 | $strDayWeek = ''; |
| 34 | |
| 35 | if($formatDate!='small_date') |
| 36 | $formatMonth='month_mini'; |
| 37 | |
| 38 | $strMonth = ${$formatMonth}[date(${$formatMonth.'_execute'},$time)]; |
| 39 | $strDayWeek = empty($formatDayWeek) ? '' : ${$formatDayWeek}[date(${$formatDayWeek.'_execute'},$time)] . ', '; |
| 40 | |
| 41 | switch($formatDate) |
| 42 | { |
| 43 | case 'small_date': |
| 44 | return date("d", $time) . "-" . $strMonth . "-". date($formatYear,$time); |
| 45 | break; |
| 46 | |
| 47 | case 'mini_date': |
| 48 | return date("d", $time) . "-" . $strMonth . "-". date($formatYear,$time); |
| 49 | break; |
| 50 | |
| 51 | default: |
| 52 | return $strDayWeek . date("d", $time) . " de " . $strMonth . " de ". date($formatYear,$time); |
| 53 | break; |
| 54 | } |
| 55 | |
| 56 | |
| 57 | } |
| 58 | elseif( $part === true ) |
| 59 | { |
| 60 | //if( ! empty( $print_hoy[$formatDate] ) && date("d-m-Y", $time ) == date("d-m-Y") ) return "HOY"; |
| 61 | if( !empty(${$formatDate}) && !empty(${$formatDate}[date(${$formatDate.'_execute'},$time)])) |
| 62 | return ${$formatDate}[date(${$formatDate.'_execute'},$time)]; |
| 63 | else |
| 64 | return date($formatDate, $time); |
| 65 | } |
| 66 | else |
| 67 | { |
| 68 | return date("d-m-Y H:i", $time); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | function echonf($iCantidad, $donotecho = false, $depth = 2, $thsep=",") |
| 73 | { |
| 74 | if(!$donotecho) |
| 75 | echo number_format(floatval($iCantidad) ?? 0, $depth, '.', $thsep); |
| 76 | else |
| 77 | return number_format(floatval($iCantidad) ?? 0, $depth, '.', $thsep); |
| 78 | } |
| 79 | |
| 80 | function BoldaString($s) |
| 81 | { |
| 82 | return '<strong>'.$s.'</strong>'; |
| 83 | } |
| 84 | |
| 85 | function EstilizaCampo($tabla, $campo, $id_nombre, $id_valor, $atributo = '') |
| 86 | { |
| 87 | $tabla = strit($tabla); |
| 88 | $campo = strit($campo); |
| 89 | $id_nombre = strit($id_nombre); |
| 90 | $id_valor = strit($id_valor); |
| 91 | |
| 92 | if($atributo == '') |
| 93 | { |
| 94 | $estilosql = "SELECT * FROM estilos WHERE tabla = $tabla AND campo = $campo AND id_nombre = $id_nombre AND id_valor = $id_valor"; |
| 95 | $estiloarray = ia_sqlArrayIndx($estilosql); |
| 96 | $styletxt = ''; |
| 97 | if($estiloarray) foreach($estiloarray as $k=>$estilorow) |
| 98 | { |
| 99 | $styletxt .= "$estilorow[atributo]:$estilorow[valor];"; |
| 100 | } |
| 101 | return $styletxt; |
| 102 | |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | $atributo = strit($atributo); |
| 107 | |
| 108 | $estilosql = "SELECT * FROM estilos WHERE tabla = $tabla AND campo = $campo AND id_nombre = $id_nombre AND id_valor = $id_valor AND atributo = $atributo"; |
| 109 | $estiloarray = ia_singleton($estilosql); |
| 110 | |
| 111 | return $estiloarray["valor"]; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * isValueonArray |
| 117 | * |
| 118 | * Busca un valor en un array. |
| 119 | * @param $arr = Array en donde buscaremos. Puede ser un array de arrays. |
| 120 | * @param $val = Valor a buscar. |
| 121 | * @return $foundit = (int) la posición en el array principal en donde se encontró el valor. |
| 122 | * false si no se encontró el valor. |
| 123 | */ |
| 124 | function isValueonArray($arr, $val) |
| 125 | { |
| 126 | $foundit = false; |
| 127 | if(is_array($arr) && !empty($arr)) foreach($arr as $k=>$v) |
| 128 | { |
| 129 | if(is_array($v)) |
| 130 | { |
| 131 | $foundit = isValueonArray($v, $val); |
| 132 | if($foundit !== false) |
| 133 | $foundit = $k; |
| 134 | } |
| 135 | else if($v == $val) |
| 136 | $foundit = $k; |
| 137 | if($foundit !== false) |
| 138 | break; |
| 139 | } |
| 140 | return $foundit; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * doOperation() |
| 145 | * |
| 146 | * Hace una operacion en un array. |
| 147 | * @param $type = Tipo de operacion: COUNT, SUM, MAX, MIN. |
| 148 | * @param $arr = el array. si se manda llamar desde el modulo reporteador, puede enviar un array de arrays, entonces hay que especificar en que key viene el valor con el que se quiere hacer la operacion. |
| 149 | * @param $options = un array con opciones. la primera es $v_pos, por si envia un array de array, saber en qué posición está el valor. Es un entero, por default es cero. El segundo es $c_zero, si quieres que el contador discrimine el valor 0.00. Es un bool, true sí hace diferencia y no toma en cuenta los ceros. Por default es false. |
| 150 | * @return $result = el resultado de la operación. |
| 151 | * false si ocurrió un error. |
| 152 | */ |
| 153 | // MONEDA 25/OCT |
| 154 | // Arr Dif 24-06-2022 |
| 155 | function doOperation($type, $arr, $v_pos = false, $mon=array(), $arr_dif=array(), $arr_totales = false) |
| 156 | { |
| 157 | if($type == '') |
| 158 | return false; |
| 159 | $type = strtoupper($type); |
| 160 | $result = false; |
| 161 | |
| 162 | $moneda=false; |
| 163 | if(is_array($mon) && !empty($mon)) |
| 164 | { |
| 165 | $moneda=true; |
| 166 | $result=array(); |
| 167 | } |
| 168 | |
| 169 | $dif=false; |
| 170 | if(is_array($arr_dif) && !empty($arr_dif)) |
| 171 | { |
| 172 | $dif=true; |
| 173 | $result=array(); |
| 174 | } |
| 175 | |
| 176 | // echo "<pre>arr_totales <br />".print_r($arr_totales, true)."</pre>"; |
| 177 | |
| 178 | if($moneda===false && $dif===false) |
| 179 | { |
| 180 | switch ($type) |
| 181 | { |
| 182 | case 'COUNT': |
| 183 | $result = sizeof($arr); |
| 184 | break; |
| 185 | |
| 186 | case 'COUNTWZERO': |
| 187 | $result = 0; |
| 188 | foreach($arr as $k=>$v) |
| 189 | { |
| 190 | if(is_array($v)) |
| 191 | { |
| 192 | if($v[$v_pos] > 0.00) |
| 193 | $result++; |
| 194 | } |
| 195 | else |
| 196 | { |
| 197 | if($v > 0.00) |
| 198 | $result++; |
| 199 | } |
| 200 | } |
| 201 | break; |
| 202 | |
| 203 | case 'SUM': |
| 204 | $tmpsum = 0; |
| 205 | foreach($arr as $k=>$v) |
| 206 | { |
| 207 | if(is_array($v)) |
| 208 | { |
| 209 | if(is_numeric($v[$v_pos])) |
| 210 | $tmpsum += $v[$v_pos]; |
| 211 | } |
| 212 | else if($v_pos === false && is_numeric($v)) |
| 213 | $tmpsum += $v; |
| 214 | /*else if(is_array($v) && is_string($v[1])) |
| 215 | { |
| 216 | $v = $v[1]; |
| 217 | $tmpsum .= $v; |
| 218 | }*/ |
| 219 | |
| 220 | } |
| 221 | $result = $tmpsum; |
| 222 | break; |
| 223 | |
| 224 | case 'MAX': |
| 225 | |
| 226 | if(is_array($arr[0])) |
| 227 | { |
| 228 | $tmpmax = $arr[0][$v_pos]; |
| 229 | foreach($arr as $k=>$v) |
| 230 | if($v[$v_pos] > $tmpmax) $tmpmax = $v[$v_pos]; |
| 231 | } |
| 232 | else |
| 233 | { |
| 234 | $tmpmax = $arr[0]; |
| 235 | foreach($arr as $k=>$v) |
| 236 | if($v > $tmpmax) $tmpmax = $v; |
| 237 | } |
| 238 | $result = $tmpmax; |
| 239 | break; |
| 240 | |
| 241 | case 'MIN': |
| 242 | if(is_array($arr[0])) |
| 243 | { |
| 244 | $tmpmin = $arr[0][$v_pos]; |
| 245 | foreach($arr as $k=>$v) |
| 246 | if($v[$v_pos] < $tmpmin) $tmpmin = $v[$v_pos]; |
| 247 | } |
| 248 | else |
| 249 | { |
| 250 | $tmpmin = $arr[0]; |
| 251 | foreach($arr as $k=>$v) |
| 252 | if($v < $tmpmin) $tmpmin = $v; |
| 253 | } |
| 254 | $result = $tmpmin; |
| 255 | break; |
| 256 | |
| 257 | default: |
| 258 | return false; |
| 259 | break; |
| 260 | } |
| 261 | } |
| 262 | elseif($moneda===true) |
| 263 | { |
| 264 | $result[0] = 0; |
| 265 | $result[1] = 0; |
| 266 | switch ($type) |
| 267 | { |
| 268 | case 'COUNT': |
| 269 | foreach($arr as $k=>$v) |
| 270 | { |
| 271 | if($mon[$k][$v_pos]=='PESOS') |
| 272 | $result[0]++; |
| 273 | else |
| 274 | $result[1]++; |
| 275 | } |
| 276 | break; |
| 277 | |
| 278 | case 'COUNTWZERO': |
| 279 | foreach($arr as $k=>$v) |
| 280 | { |
| 281 | if(is_array($v)) |
| 282 | { |
| 283 | if($v[$v_pos] > 0.00) |
| 284 | if($mon[$k][$v_pos]=='PESOS') |
| 285 | $result[0]++; |
| 286 | else |
| 287 | $result[1]++; |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | if($v > 0.00) |
| 292 | if($mon[$k][$v_pos]=='PESOS') |
| 293 | $result[0]++; |
| 294 | else |
| 295 | $result[1]++; |
| 296 | } |
| 297 | } |
| 298 | break; |
| 299 | |
| 300 | case 'SUM': |
| 301 | foreach($arr as $k=>$v) |
| 302 | { |
| 303 | if(is_array($v)) |
| 304 | { |
| 305 | if(is_numeric($v[$v_pos])) |
| 306 | { |
| 307 | if($mon[$k][$v_pos]=='PESOS') |
| 308 | $result[0] += $v[$v_pos]; |
| 309 | else |
| 310 | $result[1] += $v[$v_pos]; |
| 311 | |
| 312 | } |
| 313 | } |
| 314 | else if(is_numeric($v)) |
| 315 | { |
| 316 | if($mon[$k][$v_pos]=='PESOS') |
| 317 | $result[0] += $v; |
| 318 | else |
| 319 | $result[1] += $v; |
| 320 | } |
| 321 | } |
| 322 | break; |
| 323 | |
| 324 | default: |
| 325 | return false; |
| 326 | break; |
| 327 | } |
| 328 | } |
| 329 | elseif($dif===true) |
| 330 | { |
| 331 | $result[0] = 0; |
| 332 | // $result[1] = 0; |
| 333 | $dif_en_totales = $arr_totales[at_ValDif]; |
| 334 | $dif_es_array = is_array($dif_en_totales); |
| 335 | $hubo_ambos_estados = false; |
| 336 | switch ($type) |
| 337 | { |
| 338 | case 'COUNT': |
| 339 | foreach($arr as $k=>$v) |
| 340 | { |
| 341 | if(strtolower($arr_dif[$k][$v_pos])==strtolower($arr_totales[at_ValDif])) |
| 342 | $result[0]++; |
| 343 | } |
| 344 | break; |
| 345 | |
| 346 | case 'COUNTWZERO': |
| 347 | foreach($arr as $k=>$v) |
| 348 | { |
| 349 | if(is_array($v)) |
| 350 | { |
| 351 | if($v[$v_pos] > 0.00) |
| 352 | if(strtolower($arr_dif[$k][$v_pos])==strtolower($arr_totales[at_ValDif])) |
| 353 | $result[0]++; |
| 354 | } |
| 355 | else |
| 356 | { |
| 357 | if($v > 0.00) |
| 358 | if(strtolower($arr_dif[$k][$v_pos])==strtolower($arr_totales[at_ValDif])) |
| 359 | $result[0]++; |
| 360 | } |
| 361 | } |
| 362 | break; |
| 363 | |
| 364 | case 'SUM': |
| 365 | foreach($arr as $k=>$v) |
| 366 | { |
| 367 | $dif_en_buffer = strtolower($arr_dif[$k][$v_pos]); |
| 368 | if(is_array($v)) |
| 369 | { |
| 370 | if(is_numeric($v[$v_pos])) |
| 371 | { |
| 372 | |
| 373 | if($dif_es_array){ |
| 374 | $op_en_totales = strtolower($dif_en_totales[$dif_en_buffer]); |
| 375 | // echo "<pre>$k: <br />".print_r($dif_en_totales, true)."</pre>"; |
| 376 | // echo "<pre>dif_en_buffer:$dif_en_buffer, op_en_totales: $op_en_totales ======="; |
| 377 | |
| 378 | switch($op_en_totales){ |
| 379 | case "+": |
| 380 | $result[0] += $v[$v_pos]; |
| 381 | $hubo_ambos_estados = true; |
| 382 | break; |
| 383 | case "-": |
| 384 | $result[0] -= $v[$v_pos]; |
| 385 | break; |
| 386 | } |
| 387 | } |
| 388 | elseif(strtolower($dif_en_buffer)==strtolower($dif_en_totales)) { |
| 389 | // echo "<pre>$k: <br />".print_r($v, true)."</pre>"; |
| 390 | // echo "<pre>v_pos:$v_pos, at_ValDif,".at_ValDif.": <br />".print_r($arr_dif[$k], true)."</pre>"; |
| 391 | // echo "<li>".$arr_dif[$k][$v_pos] . " == " .$arr_totales[at_ValDif]; |
| 392 | // echo "<li>val: ".$v[$v_pos]; |
| 393 | $result[0] += $v[$v_pos]; |
| 394 | } |
| 395 | } |
| 396 | } |
| 397 | else if(is_numeric($v)) |
| 398 | { |
| 399 | if(strtolower($dif_en_buffer)==strtolower($dif_en_totales)) |
| 400 | $result[0] += $v; |
| 401 | } |
| 402 | } |
| 403 | if(!$hubo_ambos_estados && $result[0] < 0) |
| 404 | $result[0] = $result[0] *-1; |
| 405 | break; |
| 406 | |
| 407 | default: |
| 408 | return false; |
| 409 | break; |
| 410 | } |
| 411 | } |
| 412 | //if(is_array($result)) |
| 413 | //$result = $result[1]; //Bug que no puedo explicar. |
| 414 | return $result; |
| 415 | } |
| 416 | |
| 417 | function generaArraydeunaColumna($arr, $col, $startingpos = 0, $stoppingpos = -1) |
| 418 | { |
| 419 | if($stoppingpos == -1) $stoppingpos = count($arr); |
| 420 | |
| 421 | $arr_result = array(); |
| 422 | for($vertical=$startingpos;$vertical<$stoppingpos;$vertical++) |
| 423 | { |
| 424 | //VCA PHP 8 11-03-2021 sizeof(): Argument #1 ($var) must be of type Countable|array, string given |
| 425 | $count_horizontal = count(empty($arr[$vertical]) ? array() : $arr[$vertical]); |
| 426 | for($horizontal=0;$horizontal<$count_horizontal;$horizontal++) |
| 427 | { |
| 428 | if($horizontal == $col) |
| 429 | $arr_result[]=$arr[$vertical][$horizontal]; |
| 430 | } |
| 431 | } |
| 432 | return $arr_result; |
| 433 | } |
| 434 | |
| 435 | function arrayCopy( $array ) // era array $array rjsb |
| 436 | { |
| 437 | if(empty($array)) return array(); // rjsb |
| 438 | $result = array(); |
| 439 | foreach( $array as $key => $val ) |
| 440 | { |
| 441 | if( is_array( $val ) ) |
| 442 | { |
| 443 | $result[$key] = arrayCopy( $val ); |
| 444 | } |
| 445 | elseif ( is_object( $val ) ) |
| 446 | { |
| 447 | $result[$key] = clone $val; |
| 448 | } |
| 449 | else |
| 450 | { |
| 451 | $result[$key] = $val; |
| 452 | } |
| 453 | } |
| 454 | return $result; |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * quitaespaciosintermedios() |
| 459 | * |
| 460 | * @param mixed $str |
| 461 | * @return |
| 462 | */ |
| 463 | function quitaespaciosintermedios($str) |
| 464 | { |
| 465 | $str = str_replace("\t",' ',$str ?? ''); |
| 466 | return trim(preg_replace('/\s\s+/', ' ', $str)); |
| 467 | } |
| 468 | |
| 469 | function arrayMovetoTop(&$array, $key) |
| 470 | { |
| 471 | if(array_key_exists($key,$array)) |
| 472 | { |
| 473 | $temp = array($key => $array[$key]); |
| 474 | unset($array[$key]); |
| 475 | $array = $temp + $array; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | function arrayMovetoBottom(&$array, $key) |
| 480 | { |
| 481 | if(array_key_exists($key,$array)) |
| 482 | { |
| 483 | $value = $array[$key]; |
| 484 | unset($array[$key]); |
| 485 | $array[$key] = $value; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * diferenciadeTiempo() |
| 491 | * |
| 492 | * @param mixed $fecha1 en formato ('Y-m-d H:i:s') |
| 493 | * @param mixed $fecha2 en formato ('Y-m-d H:i:s') |
| 494 | * @param mixed $formato posibles valores: 'minutos','horas','dias' |
| 495 | * @return float $diferencia. Un entero con la diferencia entre la primera y la segunda fecha. |
| 496 | */ |
| 497 | function diferenciadeTiempo($fecha1='', $fecha2='', $formato='minutos', $origen_debug = "") |
| 498 | { |
| 499 | $now = new DateTime(); |
| 500 | |
| 501 | if(empty($fecha1) || $fecha1 == '0000-00-00 00:00:00') |
| 502 | $fecha1 = $now->format('Y-m-d H:i:s'); |
| 503 | |
| 504 | if(empty($fecha2) || $fecha2 == '0000-00-00 00:00:00') |
| 505 | $fecha2 = $now->format('Y-m-d H:i:s'); |
| 506 | |
| 507 | |
| 508 | $fecha1 = new DateTime($fecha1); |
| 509 | $fecha1->setTimezone(new DateTimeZone('-0500')); |
| 510 | |
| 511 | $fecha2 = new DateTime($fecha2); |
| 512 | $fecha2->setTimezone(new DateTimeZone('-0500')); |
| 513 | |
| 514 | $intervalo = $fecha1->diff($fecha2); |
| 515 | // |
| 516 | // echo "<br /><br />$origen_debug<br /><br /><pre>fecha1".print_r($fecha1,true)."</pre>"; |
| 517 | // echo "<pre>fecha2".print_r($fecha2,true)."</pre>"; |
| 518 | // echo "<pre>intervalo".print_r($intervalo,true)."</pre>"; |
| 519 | $diferencia = 0; |
| 520 | |
| 521 | switch($formato) |
| 522 | { |
| 523 | case 'minutos': |
| 524 | //echo "calculando $formato s<br />"; |
| 525 | $diferencia += $intervalo->days * 24 * 60; |
| 526 | $diferencia += $intervalo->h * 60; |
| 527 | $diferencia += $intervalo->i; |
| 528 | break; |
| 529 | |
| 530 | case 'horas': |
| 531 | //echo "calculando $formato s<br />"; |
| 532 | $diferencia += $intervalo->days * 24; |
| 533 | $diferencia += $intervalo->h; |
| 534 | $diferencia += $intervalo->i / 60; |
| 535 | break; |
| 536 | |
| 537 | case 'dias': |
| 538 | //echo "calculando $formato s<br />"; |
| 539 | $diferencia += $intervalo->days; |
| 540 | $diferencia += $intervalo->h / 24; |
| 541 | $diferencia += $intervalo->i / 24 / 60; |
| 542 | break; |
| 543 | |
| 544 | //si mandan un formato distinto, establecemos minutos. |
| 545 | default: |
| 546 | //echo "calculando $formato s por default<br />"; |
| 547 | $diferencia += $intervalo->days * 24 * 60; |
| 548 | $diferencia += $intervalo->h * 60; |
| 549 | $diferencia += $intervalo->i; |
| 550 | break; |
| 551 | } |
| 552 | |
| 553 | return $diferencia; |
| 554 | } |
| 555 | |
| 556 | /** |
| 557 | * limpiaCantidad() |
| 558 | * |
| 559 | * @param mixed $str |
| 560 | * @return |
| 561 | */ |
| 562 | function limpiaCantidad($str, $negative=true) |
| 563 | { |
| 564 | $str = trim(ltrim($str ?? '')); |
| 565 | if($negative) |
| 566 | return (float) preg_replace("/[^\d\-.]+/", "", $str); //VCA 08-03-2021. A partir de PHP 7.4 se tiene que escapar el guión. |
| 567 | else |
| 568 | return (float) preg_replace("/[^\d.]+/", "", $str); |
| 569 | } |
| 570 | |
| 571 | function limpiaCantidad_($str, $negative=true) |
| 572 | { |
| 573 | $str = trim(ltrim($str ?? '')); |
| 574 | if($negative) |
| 575 | return preg_replace("/[^\d\-.]+/", "", $str); //VCA 08-03-2021. A partir de PHP 7.4 se tiene que escapar el guión. |
| 576 | else |
| 577 | return preg_replace("/[^\d.]+/", "", $str); |
| 578 | } |
| 579 | |
| 580 | function vx_trim($str,$delws=false) |
| 581 | { |
| 582 | //Hacemos un Trim total: izquierdo, derecho, espacios intermedios y lineas nuevas. Sólo sirve para GeneraCadenaOriginal y XML 2.2 y 3.2 |
| 583 | /** |
| 584 | $str = str_replace("\n"," ",$str); |
| 585 | $str = str_replace("\r"," ",$str); |
| 586 | $str = str_replace("\r\n"," ",$str); |
| 587 | $str = str_replace("\t",' ',$str); |
| 588 | **/ |
| 589 | $replacement = $delws ? "" : " "; |
| 590 | $str = rtrim(trim(preg_replace('/\s\s+/', $replacement, $str ?? ''))); |
| 591 | return preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', $replacement, $str ?? ''); |
| 592 | // return preg_replace(array('/[^a-zA-ZÑ0-9 -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), $str); |
| 593 | } |
| 594 | |
| 595 | function sanitizeString($str) |
| 596 | { |
| 597 | |
| 598 | $a = array('Á','É','Í','Ó','Ú','&AACUTE','&EACUTE','&IACUTE','&OACUTE','&UACUTE','À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'); |
| 599 | $b = array('A', 'E', 'I', 'O', 'U', 'A', 'E', 'I', 'O', 'U', 'A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'); |
| 600 | |
| 601 | $cleanStr = str_replace($a, $b, $str); |
| 602 | $cleanStr = strtoupper($cleanStr); |
| 603 | return $cleanStr; |
| 604 | } |
| 605 | |
| 606 | /** |
| 607 | * quitaacentos() |
| 608 | * |
| 609 | * @param mixed $str |
| 610 | * @return |
| 611 | */ |
| 612 | function quitaacentos($str) |
| 613 | { |
| 614 | $a = array('À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', 'č', 'Ď', 'ď', 'Đ', 'đ', 'Ē', 'ē', 'Ĕ', 'ĕ', 'Ė', 'ė', 'Ę', 'ę', 'Ě', 'ě', 'Ĝ', 'ĝ', 'Ğ', 'ğ', 'Ġ', 'ġ', 'Ģ', 'ģ', 'Ĥ', 'ĥ', 'Ħ', 'ħ', 'Ĩ', 'ĩ', 'Ī', 'ī', 'Ĭ', 'ĭ', 'Į', 'į', 'İ', 'ı', 'IJ', 'ij', 'Ĵ', 'ĵ', 'Ķ', 'ķ', 'Ĺ', 'ĺ', 'Ļ', 'ļ', 'Ľ', 'ľ', 'Ŀ', 'ŀ', 'Ł', 'ł', 'Ń', 'ń', 'Ņ', 'ņ', 'Ň', 'ň', 'ʼn', 'Ō', 'ō', 'Ŏ', 'ŏ', 'Ő', 'ő', 'Œ', 'œ', 'Ŕ', 'ŕ', 'Ŗ', 'ŗ', 'Ř', 'ř', 'Ś', 'ś', 'Ŝ', 'ŝ', 'Ş', 'ş', 'Š', 'š', 'Ţ', 'ţ', 'Ť', 'ť', 'Ŧ', 'ŧ', 'Ũ', 'ũ', 'Ū', 'ū', 'Ŭ', 'ŭ', 'Ů', 'ů', 'Ű', 'ű', 'Ų', 'ų', 'Ŵ', 'ŵ', 'Ŷ', 'ŷ', 'Ÿ', 'Ź', 'ź', 'Ż', 'ż', 'Ž', 'ž', 'ſ', 'ƒ', 'Ơ', 'ơ', 'Ư', 'ư', 'Ǎ', 'ǎ', 'Ǐ', 'ǐ', 'Ǒ', 'ǒ', 'Ǔ', 'ǔ', 'Ǖ', 'ǖ', 'Ǘ', 'ǘ', 'Ǚ', 'ǚ', 'Ǜ', 'ǜ', 'Ǻ', 'ǻ', 'Ǽ', 'ǽ', 'Ǿ', 'ǿ'); |
| 615 | $b = array('A', 'A', 'A', 'A', 'A', 'A', 'AE', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y', 's', 'a', 'a', 'a', 'a', 'a', 'a', 'ae', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'A', 'a', 'A', 'a', 'A', 'a', 'C', 'c', 'C', 'c', 'C', 'c', 'C', 'c', 'D', 'd', 'D', 'd', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'E', 'e', 'G', 'g', 'G', 'g', 'G', 'g', 'G', 'g', 'H', 'h', 'H', 'h', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'I', 'i', 'IJ', 'ij', 'J', 'j', 'K', 'k', 'L', 'l', 'L', 'l', 'L', 'l', 'L', 'l', 'l', 'l', 'N', 'n', 'N', 'n', 'N', 'n', 'n', 'O', 'o', 'O', 'o', 'O', 'o', 'OE', 'oe', 'R', 'r', 'R', 'r', 'R', 'r', 'S', 's', 'S', 's', 'S', 's', 'S', 's', 'T', 't', 'T', 't', 'T', 't', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'W', 'w', 'Y', 'y', 'Y', 'Z', 'z', 'Z', 'z', 'Z', 'z', 's', 'f', 'O', 'o', 'U', 'u', 'A', 'a', 'I', 'i', 'O', 'o', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'U', 'u', 'A', 'a', 'AE', 'ae', 'O', 'o'); |
| 616 | return str_replace($a, $b, $str); |
| 617 | } |
| 618 | |
| 619 | function fechaMaxima($fecha, $maxima='') |
| 620 | { |
| 621 | if(empty($fecha)) |
| 622 | return date('Y-m-d'); |
| 623 | |
| 624 | if(empty($maxima)) |
| 625 | $maxima = date('Y-m-d'); |
| 626 | |
| 627 | $fechaMov = new DateTime(date('Y-m-d', strtotime($fecha))); |
| 628 | $fechaMax = new DateTime($maxima); |
| 629 | |
| 630 | if($fechaMov > $fechaMax) |
| 631 | return $fechaMax->format('Y-m-d'); |
| 632 | else |
| 633 | return date('Y-m-d', strtotime($fecha)); |
| 634 | } |
| 635 | |
| 636 | function sanitizeFileName($filename) |
| 637 | { |
| 638 | |
| 639 | $cleanFileName = strtr(str_replace(array(chr(0),chr(8),chr(27),">","<","|","&",",",";","\r","\n"),'',$filename), array('Š' => 'S','Ž' => 'Z','š' => 's','ž' => 'z','Ÿ' => 'Y','À' => 'A','Á' => 'A','Â' => 'A','Ã' => 'A','Ä' => 'A','Å' => 'A','Ç' => 'C','È' => 'E','É' => 'E','Ê' => 'E','Ë' => 'E','Ì' => 'I','Í' => 'I','Î' => 'I','Ï' => 'I','Ñ' => 'N','Ò' => 'O','Ó' => 'O','Ô' => 'O','Õ' => 'O','Ö' => 'O','Ø' => 'O','Ù' => 'U','Ú' => 'U','Û' => 'U','Ü' => 'U','Ý' => 'Y','à' => 'a','á' => 'a','â' => 'a','ã' => 'a','ä' => 'a','å' => 'a','ç' => 'c','è' => 'e','é' => 'e','ê' => 'e','ë' => 'e','ì' => 'i','í' => 'i','î' => 'i','ï' => 'i','ñ' => 'n','ò' => 'o','ó' => 'o','ô' => 'o','õ' => 'o','ö' => 'o','ø' => 'o','ù' => 'u','ú' => 'u','û' => 'u','ü' => 'u','ý' => 'y','ÿ' => 'y')); |
| 640 | $cleanFileName = strtr($cleanFileName, array('Þ' => 'TH', 'þ' => 'th', 'Ð' => 'DH', 'ð' => 'dh', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); |
| 641 | |
| 642 | $cleanFileName = preg_replace(array('/[\s]/um', '/\.[\.]+/', '/[^\w_\.\-]/'), array('_', '.', ''), $cleanFileName); |
| 643 | $cleanFileName = mb_strtolower($cleanFileName, mb_detect_encoding($cleanFileName)); //ojo |
| 644 | return $cleanFileName; |
| 645 | } |
| 646 | |
| 647 | function filtraArray($arr, $key, $val) |
| 648 | { |
| 649 | $rarr = array(); |
| 650 | |
| 651 | if(!is_array($arr) || empty($arr)) |
| 652 | return false; |
| 653 | |
| 654 | //echo "\r\nkey: $key, val: $val"; |
| 655 | foreach($arr as $k => &$v) |
| 656 | { |
| 657 | if(is_array($v)) |
| 658 | { |
| 659 | foreach($v as $kv => $vv) |
| 660 | { |
| 661 | if($kv == $key && $vv == $val) |
| 662 | { |
| 663 | //echo "\r\nkey: $key, val: $val"; |
| 664 | //echo "\r\nkv: $kv, vv: $vv"; |
| 665 | $rarr[] = $v; |
| 666 | break; |
| 667 | } |
| 668 | } |
| 669 | } |
| 670 | else |
| 671 | { |
| 672 | if($k == $key && $v == $val) |
| 673 | $rarr[] = $v; |
| 674 | } |
| 675 | } |
| 676 | |
| 677 | return $rarr; |
| 678 | } |
| 679 | |
| 680 | function concatena($strA, $strB) |
| 681 | { |
| 682 | return "$strA $strB"; |
| 683 | } |
| 684 | |
| 685 | function deleteDirectory($directory, $justEmpty=false, $typeOfFile='', $olderThan=0) |
| 686 | { |
| 687 | $dotypeOfFile = strlen($typeOfFile) ? true:false; |
| 688 | $doDelete=true; |
| 689 | $now = strtotime("now"); |
| 690 | |
| 691 | if(substr($directory,-1) == "/" || substr($directory,-1) == "\\") { |
| 692 | $directory = substr($directory,0,-1); |
| 693 | } |
| 694 | |
| 695 | if(!file_exists($directory) || !is_dir($directory)) { |
| 696 | return false; |
| 697 | } elseif(!is_readable($directory)) { |
| 698 | return false; |
| 699 | } else { |
| 700 | $directoryHandle = opendir($directory); |
| 701 | |
| 702 | while ($contents = readdir($directoryHandle)) { |
| 703 | if($contents != '.' && $contents != '..') { |
| 704 | $path = $directory . "\\" . $contents; |
| 705 | |
| 706 | if(is_dir($path)) |
| 707 | { |
| 708 | deleteDirectory($path); |
| 709 | } |
| 710 | else |
| 711 | { |
| 712 | if($olderThan) |
| 713 | { |
| 714 | $fileTime = file_exists($path) ? @filemtime($path) : strtotime("2050-12-31 23:59:59"); |
| 715 | |
| 716 | //echo "<li>$path. Created: $fileTime, now: $now, olderthan: $olderThan, dtf: $dtf|, contents: $contents, typeOfFile: $typeOfFile"; |
| 717 | $doDelete = $now - $fileTime > $olderThan ? true:false; |
| 718 | } |
| 719 | else |
| 720 | $doDelete = true; |
| 721 | $doEndsWith = endsWith($contents,$typeOfFile); |
| 722 | //echo ", doDelete: $doDelete|, endsWith: $caca"; |
| 723 | if($dotypeOfFile) |
| 724 | if($doEndsWith && $doDelete) unlink($path); |
| 725 | else continue; |
| 726 | else |
| 727 | if($doDelete) unlink($path); |
| 728 | } |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | closedir($directoryHandle); |
| 733 | |
| 734 | if($justEmpty == false) { |
| 735 | if(!rmdir($directory)) { |
| 736 | return false; |
| 737 | } |
| 738 | } |
| 739 | |
| 740 | return true; |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | function isWeekend($date='') |
| 745 | { |
| 746 | if(empty($date)) |
| 747 | $date = date('Y-m-d'); |
| 748 | return (date('N', strtotime($date)) >= 6); |
| 749 | } |
| 750 | |
| 751 | function sumaDias($date,$days) |
| 752 | { |
| 753 | return date('Y-m-d', strtotime($date . "+$days days")); |
| 754 | } |
| 755 | |
| 756 | /** |
| 757 | * acentostoupper() |
| 758 | * |
| 759 | * @param mixed $str |
| 760 | * @return |
| 761 | */ |
| 762 | function acentostoupper($str) |
| 763 | { |
| 764 | $str = strtoupper($str); |
| 765 | |
| 766 | $str = str_replace("á","Á",$str); |
| 767 | $str = str_replace("é","É",$str); |
| 768 | $str = str_replace("í","Í",$str); |
| 769 | $str = str_replace("ó","Ó",$str); |
| 770 | $str = str_replace("ú","Ú",$str); |
| 771 | |
| 772 | $str = str_replace("à","Á",$str); |
| 773 | $str = str_replace("è","É",$str); |
| 774 | $str = str_replace("ì","Í",$str); |
| 775 | $str = str_replace("ò","Ó",$str); |
| 776 | $str = str_replace("ù","Ú",$str); |
| 777 | |
| 778 | $str = str_replace("'","*",$str); |
| 779 | $str = str_replace("\"","*",$str); |
| 780 | $str = str_replace("\<","*",$str); |
| 781 | $str = str_replace("\>","*",$str); |
| 782 | $str = str_replace("<","*",$str); |
| 783 | $str = str_replace(">","*",$str); |
| 784 | $str = str_replace("%","% ",$str); |
| 785 | |
| 786 | |
| 787 | $str = str_replace("Ê","Ú",$str); |
| 788 | |
| 789 | return $str; |
| 790 | |
| 791 | } |
| 792 | |
| 793 | function htmltoupper($str) |
| 794 | { |
| 795 | // return mb_strtoupper(html_entity_decode($str,ENT_COMPAT|ENT_HTML401,'UTF-8'),'UTF-8' ); |
| 796 | |
| 797 | $str = html_entity_decode($str); |
| 798 | $str = str_replace(["\\r","\\n"],' ',$str); |
| 799 | $str = preg_replace_callback('/(.*)(\<[a-z\/].*\>)(.*)/miuU', function($matches){ |
| 800 | return(mb_strtoupper($matches[1])).$matches[2]; |
| 801 | }, $str); |
| 802 | |
| 803 | /** |
| 804 | $trans = get_html_translation_table (HTML_ENTITIES); |
| 805 | $trans = array_flip ($trans); |
| 806 | $str = strtr ($str, $trans); |
| 807 | $str = strtoupper($str); |
| 808 | $str = htmlentities($str); |
| 809 | **/ |
| 810 | return $str; |
| 811 | } |
| 812 | |
| 813 | /** |
| 814 | * quitacaracraros() |
| 815 | * |
| 816 | * @param mixed $str |
| 817 | * @return |
| 818 | */ |
| 819 | function quitacaracraros($str, $pipes=false, $guionbajo=false, $punto=false) |
| 820 | { |
| 821 | if($pipes || $guionbajo || $punto) |
| 822 | { |
| 823 | if($pipes) |
| 824 | return preg_replace(array('/[^a-zA-Z0-9|.: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 825 | if($guionbajo) |
| 826 | return preg_replace(array('/[^a-zA-Z0-9_.: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 827 | if($punto) |
| 828 | return preg_replace(array('/[^a-zA-Z0-9..: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 829 | } |
| 830 | else |
| 831 | return preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 832 | } |
| 833 | |
| 834 | function arrayEstado($origen, $tipo='grid', $extra_where = "", $columnas_excluidas = array(), $addExtraWhere = true) |
| 835 | { |
| 836 | $extra_where = empty($extra_where) ? "" : " AND $extra_where "; |
| 837 | |
| 838 | if(strpos($origen, "supervision") !== false || strpos($origen, "asignacion") !== false) |
| 839 | $extra_where .= " AND " . " activo = 'Si'"; |
| 840 | |
| 841 | if ($addExtraWhere == false) { |
| 842 | $extra_where = ''; |
| 843 | } |
| 844 | |
| 845 | $sql = "SELECT estado.*, 'SI' as click FROM estado WHERE origen = '$origen' $extra_where ORDER BY orden ASC"; |
| 846 | $arrayEstado = ia_sqlArray($sql,'orden'); |
| 847 | |
| 848 | |
| 849 | |
| 850 | /** |
| 851 | $arrayEstado = array ( |
| 852 | '0' => array('valor'=>'1___________', 'clave'=> 'BL', 'descripcion'=> 'Bloqueado', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 853 | '1' => array('valor'=>'_1__________', 'clave'=> 'DEV', 'descripcion'=> 'Pedir Devolución', 'bkgcolor'=>'000000', 'color'=>'ffffff'), |
| 854 | '2' => array('valor'=>'__1_________', 'clave'=> 'CAN', 'descripcion'=> 'Pedir Cancelación', 'bkgcolor'=>'ff0000', 'color'=>'ffffff'), |
| 855 | '3' => array('valor'=>'___1________', 'clave'=> 'REG', 'descripcion'=> 'Capturado', 'bkgcolor'=>'ffffff', 'color'=>'000000'), |
| 856 | '4' => array('valor'=>'____1_______', 'clave'=> 'TER', 'descripcion'=> 'Terminado', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 857 | '5' => array('valor'=>'_____1______', 'clave'=> 'ERR', 'descripcion'=> 'Error', 'bkgcolor'=>'ff0000', 'color'=>'000000'), |
| 858 | '6' => array('valor'=>'______1_____', 'clave'=> 'INC', 'descripcion'=> 'Incompleto', 'bkgcolor'=>'7800ff', 'color'=>'ffffff'), |
| 859 | '7' => array('valor'=>'_______1____', 'clave'=> 'REV', 'descripcion'=> 'Revisado', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 860 | '8' => array('valor'=>'________1___', 'clave'=> '', 'descripcion'=> '', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 861 | '9' => array('valor'=>'_________1__', 'clave'=> '', 'descripcion'=> '', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 862 | '10' => array('valor'=>'__________1_', 'clave'=> '', 'descripcion'=> '', 'bkgcolor'=>'005baf', 'color'=>'ffffff'), |
| 863 | '11' => array('valor'=>'___________1', 'clave'=> '', 'descripcion'=> '', 'bkgcolor'=>'005baf', 'color'=>'ffffff')); |
| 864 | **/ |
| 865 | |
| 866 | foreach( $arrayEstado as $k => &$edo) |
| 867 | { |
| 868 | foreach($edo as $col => $val) { |
| 869 | //echo "<li>$col"; |
| 870 | if (in_array($col, $columnas_excluidas)) |
| 871 | unset($edo[$col]); |
| 872 | } |
| 873 | if($edo['para_quien'] == 'rony' && !usuarioTipoRony()) |
| 874 | $edo['click'] = 'NO'; |
| 875 | |
| 876 | // $arrayEstado[$k]['color_extra'] = json_decode($edo['color_extra']); |
| 877 | } |
| 878 | |
| 879 | |
| 880 | switch($origen) |
| 881 | { |
| 882 | default: |
| 883 | $arrayEstado = $arrayEstado; |
| 884 | break; |
| 885 | } |
| 886 | |
| 887 | if($tipo != 'grid') |
| 888 | { |
| 889 | //Quitamos los elementos que están en blanco. |
| 890 | foreach($arrayEstado as $k => &$edo) |
| 891 | { |
| 892 | if(strlen($edo['clave']) == 0) |
| 893 | unset($arrayEstado[$k]); |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | // if($origen== 'banco_cuenta_mov_supervision') |
| 898 | // { |
| 899 | // echo "<pre>".print_r($arrayEstado, true)."</pre>"; |
| 900 | // echo "<pre>".print_r($columnas_excluidas, true)."</pre>"; |
| 901 | // echo "<li>$sql"; |
| 902 | // echo "<li>$tipo"; |
| 903 | // } |
| 904 | return $arrayEstado; |
| 905 | } |
| 906 | |
| 907 | function estado2Html($origen, $valor) |
| 908 | { |
| 909 | |
| 910 | //echo "origen:$origen<br/>"; |
| 911 | //echo "valor:$valor<br/>"; |
| 912 | $estadoData = arrayEstado($origen); |
| 913 | $estadoValor = str_split($valor); |
| 914 | $html = '<div><table style="border-collapse:collapse; border-style: solid; border-width: 1px; border-color:gray;" class="estadoPersonalizadoRegistro">'; |
| 915 | $tRow = ''; |
| 916 | $numCols = 6; |
| 917 | |
| 918 | switch($origen) |
| 919 | { |
| 920 | case 'fiduciario': |
| 921 | $numCols = 6; |
| 922 | break; |
| 923 | |
| 924 | case 'fiduciario_contenedor': |
| 925 | $numCols = 12; |
| 926 | break; |
| 927 | |
| 928 | default: |
| 929 | $numCols = 6; |
| 930 | break; |
| 931 | } |
| 932 | |
| 933 | // dd_($estadoData); |
| 934 | |
| 935 | |
| 936 | foreach($estadoData as $i=>$cED) |
| 937 | { |
| 938 | $tCell = '<td'; |
| 939 | $onoff = '0'; |
| 940 | $cEDV = str_split($cED['valor']); |
| 941 | |
| 942 | if(!(($i-1)%$numCols)) $tRow .= '<tr>'; |
| 943 | |
| 944 | foreach($cEDV as $j=>$cVal) |
| 945 | { |
| 946 | if($cVal == '1' && $estadoValor[$j] == '1') |
| 947 | $onoff = '1'; |
| 948 | } |
| 949 | |
| 950 | $tcStyle = 'style=" '; |
| 951 | |
| 952 | if($onoff == '1') |
| 953 | { |
| 954 | $tcStyle .= "background-color: #$cED[bkgcolor] !important; "; |
| 955 | $tcStyle .= "color: #$cED[color]; "; |
| 956 | } |
| 957 | else |
| 958 | { |
| 959 | $tcStyle .= 'background-color: #ffffff; '; |
| 960 | $tcStyle .= 'color: #c0c0c0; '; |
| 961 | } |
| 962 | |
| 963 | $tcStyle .= ' width:35px; border-collapse:collapse; border-style: solid; border-width: 1px; border-color:gray;"'; |
| 964 | |
| 965 | $tCell = "$tCell $tcStyle ><strong>$cED[clave]</strong></td>"; |
| 966 | |
| 967 | $tRow .= $tCell; |
| 968 | } |
| 969 | |
| 970 | $html.="$tRow</table></div>"; |
| 971 | |
| 972 | return $html; |
| 973 | //if(($valor)) |
| 974 | } |
| 975 | |
| 976 | function compara2Arrays($post=array(),$endb=array(),$ignore=array(),$doLog=false,&$ret=array(),&$log=array(),$app_name='',$ignore4Log=array()) |
| 977 | { |
| 978 | if(!isset($ret)) |
| 979 | $ret = array(); |
| 980 | $ignore[] = 'ultimo_cambio'; $ignore[] = 'ultimo_cambio_por'; |
| 981 | $striptags = array('remarks','comentario','referencia','comments','poliza_contabilidad'); |
| 982 | |
| 983 | $tmp = array(); |
| 984 | foreach($striptags as $k=>$v) |
| 985 | if(array_key_exists($k,$post) && array_key_exists($k,$endb)) |
| 986 | { |
| 987 | $tmp[$k] = array(); |
| 988 | $tmp[$k][0] = $post[$k]; |
| 989 | $post[$k] = vx_trim(strip_tags($post[$k])); |
| 990 | $tmp[$k][1] = $endb[$k]; |
| 991 | $endb[$k] = vx_trim(strip_tags($endb[$k])); |
| 992 | } |
| 993 | // echo "<pre>tmp".print_r($tmp, true)."</pre>"; |
| 994 | // echo "<pre>post".print_r($post, true)."</pre>"; |
| 995 | // echo "<pre>endb".print_r($endb, true)."</pre>"; |
| 996 | // die(); |
| 997 | $post4c = array_diff_key($post,array_flip($ignore)); |
| 998 | $ret = array_udiff_assoc($post4c,$endb, function($a,$b){ /*echo "<li>a: $a <=> b: $b";*/ return $a != $b; }); |
| 999 | |
| 1000 | foreach($striptags as $k=>$v) |
| 1001 | if(array_key_exists($k,$ret)) |
| 1002 | $ret[$k] = $tmp[$k][0]; |
| 1003 | |
| 1004 | if($doLog) |
| 1005 | { |
| 1006 | global $gAppRelate; |
| 1007 | if(empty($gAppRelate)) |
| 1008 | $gAppRelate=new appRelate(); |
| 1009 | |
| 1010 | $app_name = "app_".$app_name; |
| 1011 | $app = new $app_name; |
| 1012 | $modo = 'R/O'; |
| 1013 | |
| 1014 | |
| 1015 | |
| 1016 | foreach($ret as $k=>$v) |
| 1017 | { |
| 1018 | //if(!array_key_exists($k,$app->campos)) $app->campos[$k]; |
| 1019 | if(in_array($k,$ignore4Log)) continue; |
| 1020 | $log[] = kvRenglon($app->label_field($k), |
| 1021 | $app->display($k,array(),$v,$modo,false,'log'), |
| 1022 | $app->display($k,array(),$endb[$k]??'',$modo,false,'log')); |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | foreach($ignore as $i) |
| 1027 | if(array_key_exists($i, $post)) |
| 1028 | $ret[$i] = $post[$i]; |
| 1029 | //echo "<pre>".print_r($ret)."</pre>"; |
| 1030 | return $ret; |
| 1031 | } |
| 1032 | |
| 1033 | function txtHaceCuantoTiempo($fuch, $nowTime, $monedaClass="txt_color_PESOS", $doClass=true, $diffCalcMin=false) |
| 1034 | { |
| 1035 | $txt_difHoras = ""; |
| 1036 | |
| 1037 | if($diffCalcMin === false) |
| 1038 | { |
| 1039 | if(empty($fuch)) |
| 1040 | $fuch=strtotime("now"); |
| 1041 | |
| 1042 | if(empty($nowTime)) |
| 1043 | $nowTime=strtotime("now"); |
| 1044 | |
| 1045 | |
| 1046 | $difOri = diferenciadeTiempo(date('Y-m-d H:i:s', $nowTime), date('Y-m-d H:i:s', $fuch), 'horas'); |
| 1047 | $difHoras = intval($difOri); |
| 1048 | $difMins = diferenciadeTiempo(date('Y-m-d H:i:s', $nowTime), date('Y-m-d H:i:s', $fuch), 'minutos') % 60; |
| 1049 | } |
| 1050 | else |
| 1051 | { |
| 1052 | $difHoras = intval($diffCalcMin/60); |
| 1053 | $difMins = $diffCalcMin % 60; |
| 1054 | } |
| 1055 | |
| 1056 | $claIni = "<strong class='$monedaClass'>"; |
| 1057 | $claFin = "</strong>"; |
| 1058 | |
| 1059 | if(!$doClass) |
| 1060 | { |
| 1061 | $claIni = ""; |
| 1062 | $claFin = ""; |
| 1063 | } |
| 1064 | |
| 1065 | |
| 1066 | |
| 1067 | switch(true) |
| 1068 | { |
| 1069 | case ($difHoras < 1): |
| 1070 | //$difMins = intval(diferenciadeTiempo(date('Y-m-d H:i:s', $nowTime), date('Y-m-d H:i:s', $fuch))); |
| 1071 | $txt_difHoras = "$claIni$difMins min$claFin"; |
| 1072 | break; |
| 1073 | |
| 1074 | case ($difHoras >= 72): |
| 1075 | if($doClass) |
| 1076 | $claIni = "<strong class='rojo'>"; |
| 1077 | $txt_difHoras = "$claIni$difHoras hrs, $difMins min$claFin"; |
| 1078 | break; |
| 1079 | |
| 1080 | case ($difHoras > 24): |
| 1081 | $txt_difHoras = "$claIni$difHoras hrs, $difMins min$claFin"; |
| 1082 | break; |
| 1083 | |
| 1084 | case ($difHoras == 1): |
| 1085 | $txt_difHoras = "$claIni 0$difHoras hrs, $difMins min$claFin"; |
| 1086 | break; |
| 1087 | |
| 1088 | |
| 1089 | case ($difHoras < 10): |
| 1090 | $txt_difHoras = "$claIni 0$difHoras hrs, $difMins min$claFin"; |
| 1091 | break; |
| 1092 | |
| 1093 | default: |
| 1094 | $txt_difHoras = "$claIni$difHoras hrs, $difMins min$claFin"; |
| 1095 | break; |
| 1096 | } |
| 1097 | |
| 1098 | return $txt_difHoras; |
| 1099 | } |
| 1100 | |
| 1101 | function startsWith($haystack, $needle) |
| 1102 | { |
| 1103 | $length = strlen($needle); |
| 1104 | return (substr($haystack, 0, $length) === $needle); |
| 1105 | } |
| 1106 | |
| 1107 | function endsWith($haystack, $needle) |
| 1108 | { |
| 1109 | $length = strlen($needle); |
| 1110 | return $length === 0 || |
| 1111 | (substr($haystack, -$length) == $needle); |
| 1112 | } |
| 1113 | |
| 1114 | /** |
| 1115 | * jj 20-Enero-2020 |
| 1116 | * */ |
| 1117 | function getDateLabel($inputDate = null, $lang = 'es', $addTime = false, $forza_numeros = false, $format = '') |
| 1118 | { |
| 1119 | if (empty($format)) |
| 1120 | $format = 'd/m/Y' . ($addTime ? ' H:i' : ''); |
| 1121 | |
| 1122 | $inputDate = empty($inputDate) ? date($format): date_format(date_create($inputDate), $format); |
| 1123 | |
| 1124 | $time = $addTime ? explode(" ", $inputDate)[1] : ''; |
| 1125 | $date = $addTime ? explode(" ", $inputDate)[0] : $inputDate; |
| 1126 | |
| 1127 | if (!$forza_numeros) { |
| 1128 | if (str_contains($format, 'd/m/Y')) { |
| 1129 | $intMont = intval(substr($date,3,2)); |
| 1130 | } else { |
| 1131 | $intMont = intval(substr($date,4,2)); |
| 1132 | } |
| 1133 | $meses = explode(" ","Null Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); |
| 1134 | $meses_es = explode(" ","Null Ene Feb Mar Abr May Jun Jul Ago Sep Oct Nov Dic"); |
| 1135 | $mes = $lang == 'es' ? $meses_es[$intMont] : $meses[$intMont]; |
| 1136 | // $time = $addTime ? explode(" ", $inputDate)[1] : ''; |
| 1137 | // $date = $addTime ? explode(" ", $inputDate)[0] : $inputDate; |
| 1138 | $inputDate = explode("/", $date); |
| 1139 | $inputDate[1] = $mes; |
| 1140 | return implode("/", $inputDate) . ($addTime ? "<small> $time Hrs.</small>" : ''); |
| 1141 | } else { |
| 1142 | return $date . ($addTime ? "<small> $time Hrs.</small>" : ''); |
| 1143 | } |
| 1144 | return $inputDate; |
| 1145 | } |
| 1146 | |
| 1147 | |
| 1148 | /** |
| 1149 | * Crea una o N Carpetas Recursivas, desde la carpeta de la aplicación hasta N niveles. |
| 1150 | * @param $elPath "c:\wamp\www\vitex\uploads\edocta\uuid" |
| 1151 | * @param $miApp "e.g. 'vitex'" |
| 1152 | * @return bool |
| 1153 | */ |
| 1154 | function valida_carpetas($elPath,$miApp){ |
| 1155 | if(strpos($elPath, $miApp)){ |
| 1156 | $antePath= explode($miApp,$elPath); |
| 1157 | $prePath= $antePath[1]; |
| 1158 | } |
| 1159 | else{ |
| 1160 | $prePath= $elPath; |
| 1161 | } |
| 1162 | if(!strpos($elPath, "/")){ |
| 1163 | $prePath= str_replace("\\", "/", $prePath); |
| 1164 | } |
| 1165 | $pathseparado= explode("/",$prePath); |
| 1166 | $Base_Path= "c:/wamp/www/".$miApp; |
| 1167 | $arrayDiscrimina= array(".",".."); |
| 1168 | $cnt=0; |
| 1169 | $pathLoop=""; |
| 1170 | foreach($pathseparado AS $key => $carpeta){ |
| 1171 | if(! empty($carpeta)){ |
| 1172 | if(! in_array($carpeta , $arrayDiscrimina)){ |
| 1173 | if($cnt == 0){ |
| 1174 | $pathLoop= $Base_Path."/".$carpeta; |
| 1175 | } |
| 1176 | else{ |
| 1177 | $pathLoop.="/".$carpeta; |
| 1178 | } |
| 1179 | if(!file_exists($pathLoop)){ |
| 1180 | @mkdir($pathLoop); |
| 1181 | } |
| 1182 | $cnt++; |
| 1183 | } |
| 1184 | } |
| 1185 | } |
| 1186 | |
| 1187 | return true; |
| 1188 | } |
| 1189 | |
| 1190 | function hayIgual($arrmovAnt,$refNva,$referenciaKey,&$log_err){ |
| 1191 | //echo "\r\n".print_r($arrmovAnt)."\r\n"; |
| 1192 | $igual=0; |
| 1193 | foreach ($arrmovAnt as $key => $movAnt) { |
| 1194 | if($movAnt[$referenciaKey]==$refNva && $movAnt['matcheado'] == 'NO') |
| 1195 | { |
| 1196 | $log_err .= "\r\nHay igual?---------------".$movAnt[$referenciaKey]."---------".$refNva."---------\r\n"; |
| 1197 | $igual=1; |
| 1198 | } |
| 1199 | } |
| 1200 | |
| 1201 | return $igual; |
| 1202 | |
| 1203 | } |
| 1204 | |
| 1205 | |
| 1206 | function conFin($movNvo,$movAnt) |
| 1207 | { |
| 1208 | $igual=0; |
| 1209 | //$arrNVO =explode("/","DEP.CHEQUES DE OTRO BANCO/0013897 OCT12 09:17 MEXICO"); |
| 1210 | //$arrANT= explode("/","DEP.CHEQUES DE OTRO BANCO/OCT12 09:17 MEXICO"); |
| 1211 | |
| 1212 | $re = '/SUCURSAL\s*:\s*(\d+)|AUTORIZACION\s*:\s*(\d+)/miS'; |
| 1213 | $n = $movNvo; |
| 1214 | $a = $movAnt; |
| 1215 | |
| 1216 | preg_match_all($re, $n, $arrNVO, PREG_SET_ORDER, 0); |
| 1217 | preg_match_all($re, $a, $arrANT, PREG_SET_ORDER, 0); |
| 1218 | |
| 1219 | |
| 1220 | |
| 1221 | if(isset($arrNVO[0][1]) && isset($arrNVO[1][2])) |
| 1222 | { |
| 1223 | |
| 1224 | // Print the entire match result |
| 1225 | //echo"<br>1.-"; |
| 1226 | //echo ($arrNVO[0][1]); |
| 1227 | //echo"<br>2.-"; |
| 1228 | //echo ($arrNVO[1][2]); |
| 1229 | //echo"<br>"; |
| 1230 | //echo"<br>R.-"; |
| 1231 | |
| 1232 | |
| 1233 | //echo"<br>1.-"; |
| 1234 | //echo ($arrANT[0][1]); |
| 1235 | //echo"<br>2.-"; |
| 1236 | //echo ($arrANT[1][2]); |
| 1237 | //echo"<br>"; |
| 1238 | //echo"<br>R.-"; |
| 1239 | |
| 1240 | //echo "<br>".intval($arrNVO[0][1])." == ".intval($arrANT[0][1]) ." && ". intval($arrNVO[1][2])." == ".intval($arrANT[1][2]); |
| 1241 | //echo "<br>"; |
| 1242 | |
| 1243 | if(intval($arrNVO[0][1])==intval($arrANT[0][1]) && intval($arrNVO[1][2])==intval($arrANT[1][2])) |
| 1244 | { |
| 1245 | return true; |
| 1246 | }else |
| 1247 | { |
| 1248 | return false; |
| 1249 | } |
| 1250 | |
| 1251 | }else |
| 1252 | { |
| 1253 | |
| 1254 | $arrNVO =explode("/",$movNvo); |
| 1255 | $arrANT= explode("/",$movAnt); |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | //echo"\r\n".$arrANT[0]."==".$arrNVO[0]; |
| 1260 | |
| 1261 | if(array_key_exists(1, $arrANT) && array_key_exists(1, $arrNVO) && ($arrANT[0]==$arrNVO[0] || $arrANT[1]==$arrNVO[1])) |
| 1262 | { |
| 1263 | $dif1=0; |
| 1264 | $dif2=0; |
| 1265 | // echo"\r\n".$arrANT[0]."==".$arrNVO[0]; |
| 1266 | $arrNVOfin =explode(" ",$arrANT[1]); |
| 1267 | $arrANTfin= explode(" ",$arrNVO[1]); |
| 1268 | //echo"\r\n"; |
| 1269 | //echo"\r\n"; |
| 1270 | //print_r($arrNVOfin); |
| 1271 | //echo"\r\n"; |
| 1272 | //print_r($arrANTfin); |
| 1273 | |
| 1274 | if ($arrNVOfin[0]!=$arrANTfin[0]) |
| 1275 | { |
| 1276 | $com_tam=count($arrNVOfin)-count($arrANTfin); |
| 1277 | |
| 1278 | if($com_tam<=0) |
| 1279 | { |
| 1280 | $tam=count($arrNVOfin); |
| 1281 | $dif1=$com_tam*(-1); |
| 1282 | }else{ |
| 1283 | $tam=count($arrANTfin); |
| 1284 | $dif2=$com_tam; |
| 1285 | } |
| 1286 | |
| 1287 | for ($i=($tam-1); $i >=0 ; $i--) |
| 1288 | { |
| 1289 | //echo"\r\n\r\n".$arrNVOfin[$i+$dif2]."==".$arrANTfin[$i+$dif1]; |
| 1290 | |
| 1291 | if($arrNVOfin[$i+$dif2]==$arrANTfin[$i+$dif1]) |
| 1292 | { |
| 1293 | $igual++; |
| 1294 | } |
| 1295 | } |
| 1296 | //echo "\r\n".(($igual/$tam)*100)."%"; |
| 1297 | if((($igual/$tam)*100)>=50) |
| 1298 | { |
| 1299 | return true; |
| 1300 | }else{ |
| 1301 | return false; |
| 1302 | } |
| 1303 | }else{ |
| 1304 | return true; |
| 1305 | } |
| 1306 | |
| 1307 | }else |
| 1308 | { |
| 1309 | return false; |
| 1310 | } |
| 1311 | } |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | } |
| 1316 | |
| 1317 | |
| 1318 | function comparaStrings($str1, $str2) |
| 1319 | { |
| 1320 | $str1 = vx_trim(str_replace("/", " ", $str1)); |
| 1321 | $str2 = vx_trim(str_replace("/", " ", $str2)); |
| 1322 | |
| 1323 | $str1 = explode(" ", $str1); |
| 1324 | $str2 = explode(" ", $str2); |
| 1325 | |
| 1326 | return (float) comparaArrays($str1, $str2); |
| 1327 | } |
| 1328 | |
| 1329 | function comparaArrays($ngram1, $ngram2) { |
| 1330 | $sum = array_unique(array_merge($ngram1, $ngram2)); |
| 1331 | $intersection = array_intersect($ngram1, $ngram2); |
| 1332 | |
| 1333 | //echo "<pre>sum: ".print_r($sum, true)."</pre>"; |
| 1334 | //echo "<pre>intersection: ".print_r($intersection, true)."</pre>"; |
| 1335 | $score = count($intersection) / count($sum); |
| 1336 | return (float) $score; |
| 1337 | } |
| 1338 | |
| 1339 | function limpiaTagsdeRemarks($string = "") |
| 1340 | { |
| 1341 | //$st = htmlentities($string, null, 'utf-8'); |
| 1342 | $st = $string; |
| 1343 | $st = str_replace(array("<br />", "<br/>", "<br>", "<br >", " ", "<p>")," ",$st); |
| 1344 | $st = html_entity_decode(html_entity_decode($st)); |
| 1345 | //$st = htmlentities($string, null, 'utf-8'); |
| 1346 | //$st = str_replace(array("<br />", "<br/>", "<br>", "<br >", " ", "<p>")," ",$st); |
| 1347 | //$st = html_entity_decode($st); |
| 1348 | $st = addslashes(strip_tags(vx_trim($st))); |
| 1349 | $st = preg_replace("/ /",'',$st); |
| 1350 | $st = vx_trim($st); |
| 1351 | |
| 1352 | return $st; |
| 1353 | } |
| 1354 | |
| 1355 | function calculaPagina2Reg($totalRn, $primerRn, $ultimoRn, &$result) |
| 1356 | { |
| 1357 | //$totalRn = 8500; |
| 1358 | $rowNum = 100; |
| 1359 | //$primerRn = 4230; |
| 1360 | //$ultimoRn = 4650; |
| 1361 | $pagina = 1; |
| 1362 | $yarife = false; |
| 1363 | $dif = 0; |
| 1364 | |
| 1365 | $paginas = max( ceil($totalRn / $rowNum ),1); |
| 1366 | $tmp = $ultimoRn; |
| 1367 | |
| 1368 | $ultimoRn = $ultimoRn > $primerRn ? $ultimoRn : $primerRn; |
| 1369 | $primerRn = $tmp != $ultimoRn ? $tmp : $primerRn; |
| 1370 | |
| 1371 | $dif = $ultimoRn > $primerRn ? $ultimoRn - $primerRn : $primerRn - $ultimoRn; |
| 1372 | $i = 0; |
| 1373 | |
| 1374 | $rowList = array(50,100,200,500,1000,2000,5000,10000000); |
| 1375 | $rlIndex = 0; |
| 1376 | /** |
| 1377 | echo "<li>dif ori: $dif"; |
| 1378 | echo "<li>totalRn: $totalRn"; |
| 1379 | echo "<li>primerRn: $primerRn"; |
| 1380 | echo "<li>ultimoRn: $ultimoRn"; |
| 1381 | **/ |
| 1382 | |
| 1383 | |
| 1384 | do |
| 1385 | { |
| 1386 | foreach($rowList as $k=>$rowsDiff) |
| 1387 | if($rowsDiff > $dif) |
| 1388 | { |
| 1389 | $dif = $rowsDiff; |
| 1390 | $rlIndex = $k; |
| 1391 | break; |
| 1392 | } |
| 1393 | |
| 1394 | $paginas = max( ceil($totalRn / $dif ),1); |
| 1395 | |
| 1396 | $pag1 = max( floor ($primerRn / $dif),1); |
| 1397 | |
| 1398 | $pag2 = max( ceil ($ultimoRn / $dif),1); |
| 1399 | |
| 1400 | $yarife = (($pag2 - $pag1) == 1) || $pag2 == $pag1; |
| 1401 | |
| 1402 | $dif = !$yarife ? $dif : $rowList[$rlIndex+1]; |
| 1403 | /** |
| 1404 | echo "<li>paginas: $paginas"; |
| 1405 | echo "<li>pag1: $pag1"; |
| 1406 | echo "<li>pag2: $pag2"; |
| 1407 | echo "<li>dif: $dif"; |
| 1408 | echo "<li>yarife: $yarife"; |
| 1409 | |
| 1410 | |
| 1411 | |
| 1412 | $blanks = str_pad('',4096,' '); |
| 1413 | echo $blanks; |
| 1414 | ob_flush(); flush(); |
| 1415 | * |
| 1416 | * **/ |
| 1417 | $i++; |
| 1418 | }while(!$yarife && $i < 8); |
| 1419 | |
| 1420 | |
| 1421 | $result['pageGrid'] = $pag1; |
| 1422 | $result['rowNum'] = $dif; |
| 1423 | |
| 1424 | return true; |
| 1425 | } |
| 1426 | |
| 1427 | function send_mail($emailAsunto="Error en Programa ",$emailCuerpoMensaje=''){ |
| 1428 | require_once ("Mail.php"); |
| 1429 | require_once ("Mail/mime.php"); |
| 1430 | |
| 1431 | |
| 1432 | |
| 1433 | $html_message = '<p>'. $emailCuerpoMensaje .'</p>'; |
| 1434 | $headers["Return-Path"] = "vitex@evinux.net"; |
| 1435 | $headers["Sender"] = "vitex@evinux.net"; |
| 1436 | $headers["From"] = "VITEX<vitex@evinux.net>"; |
| 1437 | $headers["To"] = "VITEX TESTER<vitextest@gmail.com>"; |
| 1438 | $headers["Subject"] = $emailAsunto; |
| 1439 | //$headers["Cc"] = "Rony Akiki <correo@host.com>"; |
| 1440 | $headers["Reply-To"] = "VITEX<vitex@evinux.net>"; |
| 1441 | //$headers["Read-Receipt-To"] = "VITEX<vitex@evinux.net>"; |
| 1442 | //$headers["Return-Receipt-Requested"] = "VITEX<vitex@evinux.net>"; |
| 1443 | $headers["X-Confirm-Reading-To"] = "VITEX<vitex@evinux.net>"; |
| 1444 | $headers["X-Priority"] = "1 (Highest)"; |
| 1445 | $headers["Importance"] = "High"; |
| 1446 | $headers["Disposition-Notification-To"] = "VITEX<vitex@evinux.net>"; |
| 1447 | |
| 1448 | |
| 1449 | $mime_params = array(); |
| 1450 | |
| 1451 | $mime_params['eol'] = "\n"; |
| 1452 | $mime_params['delay_file_io'] = true; |
| 1453 | $mime_params['head_encoding'] = "quoted-printable"; |
| 1454 | $mime_params['text_encoding'] = "quoted-printable"; |
| 1455 | $mime_params['html_encoding'] = "quoted-printable"; |
| 1456 | $mime_params['head_charset'] = "UTF-8"; |
| 1457 | $mime_params['text_charset'] = "UTF-8"; |
| 1458 | $mime_params['html_charset'] = "UTF-8"; |
| 1459 | |
| 1460 | $mime = new Mail_mime($mime_params); |
| 1461 | |
| 1462 | $mime->setHTMLBody(trim($html_message ?? '')); |
| 1463 | |
| 1464 | $message = $mime->get(); |
| 1465 | $headers = $mime->headers($headers, true); |
| 1466 | |
| 1467 | |
| 1468 | $params["host"] = 'mail.evinux.net'; |
| 1469 | $params["port"] = '587'; |
| 1470 | $params["auth"] = TRUE; // note: there are *no delimiters* |
| 1471 | $params["username"] = 'vitex@evinux.net'; |
| 1472 | $params["password"] = 'vit986532@'; |
| 1473 | |
| 1474 | |
| 1475 | |
| 1476 | |
| 1477 | $mail_message = Mail::factory('smtp', $params); |
| 1478 | $send = $mail_message->send ('vitex@evinux.net', $headers, $message); |
| 1479 | |
| 1480 | |
| 1481 | if (PEAR::isError($send)) |
| 1482 | { |
| 1483 | die(); |
| 1484 | } |
| 1485 | else |
| 1486 | { |
| 1487 | //echo"Correo Enviado"; |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | function jsonFile($fileName, $array, $flags = 0) { |
| 1492 | $ignore = ignore_user_abort(); |
| 1493 | ignore_user_abort(1); |
| 1494 | try { |
| 1495 | //VCA |
| 1496 | // los autocomplete grid combo boxes toman el md5! |
| 1497 | // $array['md5'] = md5(json_encode($array)); |
| 1498 | $ret = file_put_contents($fileName, json_encode($array, $flags), LOCK_EX); |
| 1499 | } catch(Exception $e) { |
| 1500 | $ret = false; |
| 1501 | } |
| 1502 | ignore_user_abort($ignore); |
| 1503 | return $ret; |
| 1504 | } |
| 1505 | |
| 1506 | function dd_(...$vars) |
| 1507 | { |
| 1508 | $separator = "<br/>================================================================================================<br/>"; |
| 1509 | $print = []; |
| 1510 | foreach ($vars as $key => $var) { |
| 1511 | // $print[] = "<pre>\n\t<strong>VAR $key: (".gettype($var).") </strong>\n\t<h5>\n\t\t". print_r($var , true) . "\n\t</h5>\n</pre>\n$separator"; |
| 1512 | // echo "\n<pre>\n\t<strong>VAR $key: (".gettype($var).") </strong>\n\t<h5>\n\t\t". print_r($var , true) . "\n\t</h5>\n</pre>\n$separator\n"; |
| 1513 | if (gettype($var) === 'boolean') { |
| 1514 | $print[] = "<pre><strong>VAR $key: (".gettype($var).") </strong><h5>". var_export($var , true) . "</h5></pre>$separator"; |
| 1515 | continue; |
| 1516 | } |
| 1517 | $print[] = "<pre><strong>VAR $key: (".gettype($var).") </strong><h5>". print_r($var , true) . "</h5></pre>$separator"; |
| 1518 | } |
| 1519 | echo "\n".implode("\n", $print)."\n"; |
| 1520 | die("<h5><b>END VARS TESTIE</b></h5><script>$(document).ready( function() { setTimeout(function() { $('#loadingMask').fadeOut(0); }, 10); });</script>"); |
| 1521 | } |
| 1522 | |
| 1523 | function v_d(...$vars) |
| 1524 | { |
| 1525 | $separator = "<br/>================================================================================================<br/>"; |
| 1526 | $print = []; |
| 1527 | foreach ($vars as $key => $var) { |
| 1528 | // $print[] = "<pre>\n\t<strong>VAR $key: (".gettype($var).") </strong>\n\t<h5>\n\t\t". print_r($var , true) . "\n\t</h5>\n</pre>\n$separator"; |
| 1529 | // echo "\n<pre>\n\t<strong>VAR $key: (".gettype($var).") </strong>\n\t<h5>\n\t\t". print_r($var , true) . "\n\t</h5>\n</pre>\n$separator\n"; |
| 1530 | if (gettype($var) === 'boolean') { |
| 1531 | $print[] = "<pre><strong>VAR $key: (".gettype($var).") </strong><h5>". var_export($var , true) . "</h5></pre>$separator"; |
| 1532 | continue; |
| 1533 | } |
| 1534 | $print[] = "<pre><strong>VAR $key: (".gettype($var).") </strong><h5>". print_r($var , true) . "</h5></pre>$separator"; |
| 1535 | } |
| 1536 | echo "\n".implode("\n", $print)."\n"; |
| 1537 | } |
| 1538 | |
| 1539 | function renderView($view = null, $data = []) |
| 1540 | { |
| 1541 | $dirViews = dirname(dirname(__DIR__)) . '/backoffice/view/'; |
| 1542 | $data['date'] = date("Y-m-d H:i:s"); |
| 1543 | $ini = array_key_exists('ini', $data) ? $data['ini'] : false; |
| 1544 | $path = $dirViews . $view . '.php'; |
| 1545 | $path = str_replace('\\', '/', $path); |
| 1546 | extract($data); |
| 1547 | ob_start(); |
| 1548 | include $path; |
| 1549 | // $view = ob_get_contents(); |
| 1550 | $view = str_replace('\"','"',trim(ob_get_contents())); |
| 1551 | ob_end_clean(); |
| 1552 | $view = vx_trim($view); |
| 1553 | // return preg_replace(array('/[^a-zA-Z0-9"\/<>=_.: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($view)); |
| 1554 | // return preg_replace(array('/[^a-zA-Z0-9_.: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 1555 | // return preg_replace(array('/[^a-zA-Z0-9..: -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 1556 | // return preg_replace(array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/'),array('', ' ', ''), quitaacentos($str)); |
| 1557 | // html_entity_decode |
| 1558 | return $view; |
| 1559 | } |
| 1560 | |
| 1561 | function includeView($view = null, $data = []) |
| 1562 | { |
| 1563 | $dirViews = dirname(dirname(__DIR__)) . '/backoffice/view/'; |
| 1564 | $path = $dirViews . $view . '.php'; |
| 1565 | extract($data); |
| 1566 | ob_start(); |
| 1567 | include $path; |
| 1568 | $view = str_replace('\"','"',trim(ob_get_contents())); |
| 1569 | ob_end_clean(); |
| 1570 | $view = vx_trim($view); |
| 1571 | return $view; |
| 1572 | } |
| 1573 | |
| 1574 | function hex2rgb($color = '000000', $opacity = false) { |
| 1575 | $default = 'rgb(0, 0, 0)'; |
| 1576 | //Return default if no color provided |
| 1577 | if(empty($color)) |
| 1578 | return $default; |
| 1579 | |
| 1580 | //Sanitize $color if "#" is provided |
| 1581 | if ($color[0] == '#' ) { |
| 1582 | $color = substr( $color, 1 ); |
| 1583 | } |
| 1584 | |
| 1585 | //Check if color has 6 or 3 characters and get values |
| 1586 | if (strlen($color) == 6) { |
| 1587 | $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ); |
| 1588 | } elseif ( strlen( $color ) == 3 ) { |
| 1589 | $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] ); |
| 1590 | } else { |
| 1591 | return $default; |
| 1592 | } |
| 1593 | |
| 1594 | //Convert hexadec to rgb |
| 1595 | $rgb = array_map('hexdec', $hex); |
| 1596 | |
| 1597 | //Check if opacity is set(rgba or rgb) |
| 1598 | if($opacity){ |
| 1599 | if(abs($opacity) > 1) |
| 1600 | $opacity = 1.0; |
| 1601 | $output = 'rgba('.implode(", ",$rgb).', '.$opacity.')'; |
| 1602 | } else { |
| 1603 | $output = 'rgb('.implode(", ",$rgb).')'; |
| 1604 | } |
| 1605 | |
| 1606 | //Return rgb(a) color string |
| 1607 | return $output; |
| 1608 | } |
| 1609 | |
| 1610 | function indexa_($datos, $key){ |
| 1611 | /*$array = array_combine(array_column($datos, $key), $datos);*/ |
| 1612 | $regresa = []; |
| 1613 | if($datos != null){ |
| 1614 | foreach ($datos as $d) { |
| 1615 | $indice = $d[$key]; |
| 1616 | $regresa[$indice] = $d; |
| 1617 | } |
| 1618 | } |
| 1619 | return $regresa; |
| 1620 | } |
| 1621 | |
| 1622 | function obtenNumeroRevisorGastosCuentaT($user_id = null, $tipo = 'asignacion', $posicion = null, $para_revisor = false) { |
| 1623 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1624 | $user_Estado = obtenEstadoRevisorGastosCuentaT($user_id, $tipo, $posicion, $para_revisor); |
| 1625 | return strpos($user_Estado, 'Z'); |
| 1626 | } |
| 1627 | |
| 1628 | function obtenNumeroRevisorMovimientosBanco($user_id = null, $tipo = 'asignacion', $posicion = null, $para_revisor = false) { |
| 1629 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1630 | /* if ($posicion != null) { |
| 1631 | revisaSiPuedeenPosicion($user_id, $tipo, $posicion); |
| 1632 | } */ |
| 1633 | $user_Estado = obtenEstadoRevisorMovimientosBanco($user_id, $tipo , $posicion, $para_revisor); |
| 1634 | return strpos($user_Estado, 'Z'); |
| 1635 | } |
| 1636 | |
| 1637 | function obtenEstadoRevisorGastosCuentaT($user_id = null, $tipo = 'asignacion', $posicion = null, $para_revisor = false) { |
| 1638 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1639 | $andPosicion = ($posicion != null) ? "AND posicion = '$posicion'": ""; |
| 1640 | $order = "ORDER BY orden ASC"; |
| 1641 | if ($para_revisor) { |
| 1642 | $order = "ORDER BY orden DESC"; |
| 1643 | } |
| 1644 | $query = "SELECT usuario_id, descripcion nombre,valor, origen FROM estado WHERE usuario_id = $user_id AND origen = 'cuentat_gasto_$tipo' $andPosicion $order"; |
| 1645 | $user_Estado = ia_singleton($query); |
| 1646 | return $user_Estado['valor']; |
| 1647 | |
| 1648 | } |
| 1649 | |
| 1650 | function obtenEstadoRevisorMovimientosBanco($user_id = null, $tipo = 'asignacion', $posicion = null, $para_revisor = false) { |
| 1651 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1652 | $andPosicion = ($posicion != null) ? "AND posicion = '$posicion'": ""; |
| 1653 | $order = "ORDER BY orden ASC"; |
| 1654 | if ($para_revisor) { |
| 1655 | $order = "ORDER BY orden DESC"; |
| 1656 | } |
| 1657 | $query = "SELECT usuario_id, descripcion nombre,valor, origen FROM estado WHERE usuario_id = $user_id AND origen = 'banco_cuenta_mov_$tipo' $andPosicion $order"; |
| 1658 | // echo $query. "<br>"; |
| 1659 | $user_Estado = ia_singleton($query); |
| 1660 | return $user_Estado['valor'] ?? false; |
| 1661 | |
| 1662 | } |
| 1663 | |
| 1664 | function obtenEstadoRevisorGastosCuentaTPermission($user_id = null, $tipo = 'asignacion') { |
| 1665 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1666 | $query = "SELECT usuario_id, descripcion nombre,valor, origen FROM estado WHERE activo = 'Si' AND usuario_id = $user_id AND origen = 'cuentat_gasto_$tipo'"; |
| 1667 | $user_Estado = ia_singleton($query); |
| 1668 | if (empty($user_Estado)) { |
| 1669 | return false; |
| 1670 | } |
| 1671 | return $user_Estado['valor'] ?? true; |
| 1672 | } |
| 1673 | |
| 1674 | function obtenEstadoRevisorMovimientosBancoPermission($user_id = null, $tipo = 'asignacion') { |
| 1675 | |
| 1676 | //die($user_id . " _ " . $tipo); |
| 1677 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1678 | $query = "SELECT usuario_id, descripcion nombre,valor, origen FROM estado WHERE activo = 'Si' AND usuario_id = $user_id AND origen = 'banco_cuenta_mov_$tipo'"; |
| 1679 | $user_Estado = ia_singleton($query); |
| 1680 | |
| 1681 | //echo "<pre>$query".print_r($user_Estado, true)."</pre>"; |
| 1682 | |
| 1683 | if (empty($user_Estado)) { |
| 1684 | return false; |
| 1685 | } |
| 1686 | return $user_Estado['valor'] ?? false; |
| 1687 | } |
| 1688 | |
| 1689 | function obtenPosicionesRevisor($user_id, $origen = 'banco_cuenta_mov', $tipo = 'asignacion') |
| 1690 | { |
| 1691 | // $origen -> ['banco_cuenta_mov', 'cuentat_gasto'] |
| 1692 | // $tipo -> ['asignacion', 'supervision'] |
| 1693 | // $user_id -> id de usuario para obtener posiciones |
| 1694 | |
| 1695 | $user_id = ($user_id == null) ? $_SESSION['usuario_id'] : $user_id; |
| 1696 | $origen .= "_$tipo"; |
| 1697 | |
| 1698 | $query = "SELECT posicion FROM estado WHERE usuario_id = $user_id AND origen = '$origen'"; |
| 1699 | |
| 1700 | $posiciones = ia_sqlArrayIndx($query); |
| 1701 | |
| 1702 | if (empty($posiciones)) return []; |
| 1703 | |
| 1704 | return $posiciones; |
| 1705 | } |
| 1706 | /** |
| 1707 | * Calcula el semaforo de asignación para los revisores |
| 1708 | * @param mixed $user_id id de usuario |
| 1709 | * @param string $valor_asignacion valor de campo asignacion (Default ZZZZZZZZZZZZ) |
| 1710 | * @param string $app origen de la tabla estado ('cuentat_gasto', 'banco_cuenta_mov') default 'banco_cuenta_mov' |
| 1711 | * @param string $para_quien para quien se va a calcular el semaforo |
| 1712 | * @return array $semaforo dependiendo para quien |
| 1713 | */ |
| 1714 | function calculaSemaforo($user_id = null, $valor_asignacion = 'ZZZZZZZZZZZZ', $app = 'banco_cuenta_mov', $para_quien = 'todos') |
| 1715 | { |
| 1716 | // $user_id -> ['todos', 'rony', 'otros'] |
| 1717 | $arrSemaforo = [ |
| 1718 | 1 => [ |
| 1719 | 0 => "rojo", |
| 1720 | 1 => "verde" |
| 1721 | ], |
| 1722 | 2 => [ |
| 1723 | 0 => "rojo", |
| 1724 | 1 => "naranja", |
| 1725 | 2 => "verde" |
| 1726 | ], |
| 1727 | 3 => [ |
| 1728 | 0 => "rojo", |
| 1729 | 1 => "naranja", |
| 1730 | 2 => "amarillo", |
| 1731 | 3 => "verde" |
| 1732 | ], |
| 1733 | 4 => [ |
| 1734 | 0 => "rojo", |
| 1735 | 1 => "naranja", |
| 1736 | 2 => "naranja", |
| 1737 | 3 => "amarillo", |
| 1738 | 4 => "verde" |
| 1739 | ], |
| 1740 | 5 => [ |
| 1741 | 0 => "rojo", |
| 1742 | 1 => "naranja", |
| 1743 | 2 => "naranja", |
| 1744 | 3 => "naranja", |
| 1745 | 4 => "amarillo", |
| 1746 | 5 => "verde" |
| 1747 | ], |
| 1748 | 6 => [ |
| 1749 | 0 => "rojo", |
| 1750 | 1 => "naranja", |
| 1751 | 2 => "naranja", |
| 1752 | 3 => "naranja", |
| 1753 | 4 => "amarillo", |
| 1754 | 5 => "amarillo", |
| 1755 | 6 => "verde" |
| 1756 | ], |
| 1757 | 7 => [ |
| 1758 | 0 => "rojo", |
| 1759 | 1 => "naranja", |
| 1760 | 2 => "naranja", |
| 1761 | 3 => "naranja", |
| 1762 | 4 => "naranja", |
| 1763 | 5 => "amarillo", |
| 1764 | 6 => "amarillo", |
| 1765 | 7 => "verde" |
| 1766 | ], |
| 1767 | 8 => [ |
| 1768 | 0 => "rojo", |
| 1769 | 1 => "naranja", |
| 1770 | 2 => "naranja", |
| 1771 | 3 => "naranja", |
| 1772 | 4 => "naranja", |
| 1773 | 5 => "amarillo", |
| 1774 | 6 => "amarillo", |
| 1775 | 7 => "amarillo", |
| 1776 | 8 => "verde" |
| 1777 | ] |
| 1778 | ]; |
| 1779 | |
| 1780 | $semaforo_rony = ''; |
| 1781 | $semaforo_usuarios = []; |
| 1782 | |
| 1783 | // supervisores |
| 1784 | /* Neccesito al menos el origen para obtener los revisores y supervisores */ |
| 1785 | $supervisores = traeSupervisoresRevisores(null, 'supervisor', true, $app."_supervision"); |
| 1786 | $arryPosicionesOmitirSupervisor = []; |
| 1787 | |
| 1788 | foreach($supervisores AS $key => $val){ |
| 1789 | if ($app == 'banco_cuenta_mov') { |
| 1790 | $laposicion= obtenNumeroRevisorMovimientosBanco($val["usuario_id"]); |
| 1791 | } |
| 1792 | if ($app == 'cuentat_gasto') { |
| 1793 | $laposicion= obtenNumeroRevisorGastosCuentaT($val["usuario_id"]); |
| 1794 | } |
| 1795 | $arryPosicionesOmitirSupervisor[]= $laposicion; |
| 1796 | } |
| 1797 | |
| 1798 | |
| 1799 | $elCntareas=0; |
| 1800 | $yaRevisadas=0; |
| 1801 | if ($valor_asignacion != 'ZZZZZZZZZZZZ') { |
| 1802 | $cell_value = str_split($valor_asignacion); |
| 1803 | // EMPIEZA SEMAFORO PARA RONY |
| 1804 | if(empty($user_id)){ |
| 1805 | foreach ($cell_value as $posicion => $caracter) { |
| 1806 | if (!in_array($posicion, $arryPosicionesOmitirSupervisor)) { |
| 1807 | if( $caracter != "z" and $caracter != "Z") { |
| 1808 | if ($caracter != 'A' and $caracter != 'D') { |
| 1809 | $yaRevisadas++; |
| 1810 | } |
| 1811 | $elCntareas++; |
| 1812 | } |
| 1813 | } |
| 1814 | } |
| 1815 | if ($elCntareas > 0) { |
| 1816 | $semaforo_rony = $arrSemaforo[$elCntareas][$yaRevisadas]; |
| 1817 | } |
| 1818 | } |
| 1819 | // TERMINA SEMAFORO PARA RONY |
| 1820 | |
| 1821 | // EMPIEZA SEMAFORO PARA TODOS |
| 1822 | if(! empty($user_id) || $para_quien == 'todos'){ |
| 1823 | $revisores = traeSupervisoresRevisores($user_id, 'revisor', true, $app."_asignacion"); |
| 1824 | // echo "aqui"; print_r($revisores); |
| 1825 | $elCntareas=0; |
| 1826 | $yaRevisadas=0; |
| 1827 | // dd_($revisores); |
| 1828 | foreach ($revisores as $index => $revisor) { |
| 1829 | $posiciones_de_revision = obtenPosicionesRevisor( $revisor['usuario_id'], $app, 'asignacion'); |
| 1830 | $elCntareas=0; |
| 1831 | $yaRevisadas=0; |
| 1832 | foreach ($posiciones_de_revision as $item => $posicion) { |
| 1833 | if (!in_array($posicion['posicion'], $arryPosicionesOmitirSupervisor)) { |
| 1834 | $caracter = $cell_value[$posicion['posicion']]; |
| 1835 | if( $caracter != "z" and $caracter != "Z") { |
| 1836 | if ($caracter != 'A' and $caracter != 'D' and $caracter != 'Z') { |
| 1837 | $yaRevisadas++; |
| 1838 | } |
| 1839 | $elCntareas++; |
| 1840 | } |
| 1841 | } |
| 1842 | } |
| 1843 | if ($elCntareas > 0) { |
| 1844 | $semaforo_usuarios[$revisor['usuario_id']] = $arrSemaforo[$elCntareas][$yaRevisadas]; |
| 1845 | } |
| 1846 | } |
| 1847 | } |
| 1848 | // TERMINA SEMAFORO PARA TODOS |
| 1849 | } |
| 1850 | |
| 1851 | $semaforo = [ |
| 1852 | 'rony' => $semaforo_rony, |
| 1853 | 'otros' => $semaforo_usuarios // [69 => 'rojo', 1 => 'rojo', 107 => 'verde', 72 => 'naranja'] |
| 1854 | ]; |
| 1855 | |
| 1856 | if ($para_quien == 'rony' && empty($user_id)) { |
| 1857 | unset($semaforo['otros']); |
| 1858 | } |
| 1859 | if (! empty($user_id) ) { |
| 1860 | unset($semaforo['rony']); |
| 1861 | } |
| 1862 | /* if ($para_quien == 'otros') { |
| 1863 | $semaforo = ['otros' => []]; |
| 1864 | } */ |
| 1865 | |
| 1866 | return $semaforo; |
| 1867 | } |
| 1868 | |
| 1869 | function quiesnEsSupervisor(){ |
| 1870 | |
| 1871 | } |
| 1872 | /* |
| 1873 | function revisaSiPuedeenPosicion($user_id = null, $tipo = 'asignacion', $posicion = null) |
| 1874 | { |
| 1875 | |
| 1876 | } */ |
| 1877 | |
| 1878 | function asignacion_2_html($origen, $valor, $r_id = '', $con_eventos = false, $fecha_revision = null, $posicion_revision = null, $desactiva_usuario = null, $pos_desactiva = null) |
| 1879 | { |
| 1880 | $estadoData = arrayEstado($origen); |
| 1881 | $estadoValor = str_split($valor); |
| 1882 | $numCols = 6; |
| 1883 | |
| 1884 | switch($origen) |
| 1885 | { |
| 1886 | case 'fiduciario': |
| 1887 | $numCols = 6; |
| 1888 | break; |
| 1889 | |
| 1890 | case 'fiduciario_contenedor': |
| 1891 | $numCols = 12; |
| 1892 | break; |
| 1893 | |
| 1894 | default: |
| 1895 | $numCols = 6; |
| 1896 | break; |
| 1897 | } |
| 1898 | |
| 1899 | $origen_prefix = str_replace("_asignacion", "", $origen); |
| 1900 | $origen_prefix = str_replace("_supervision", "", $origen_prefix); |
| 1901 | |
| 1902 | $div_table = '<div data-estado="'.$valor.'" class="estado-asignacion tablagen">'; |
| 1903 | $divCell = ''; |
| 1904 | $divRow = ''; |
| 1905 | $divRowEnd = ''; |
| 1906 | $dataVal = ''; |
| 1907 | $posicion = 0; |
| 1908 | $data = ""; |
| 1909 | $eventos = ""; |
| 1910 | |
| 1911 | $activaDBLClick = false; |
| 1912 | $activaContextClick = true; |
| 1913 | |
| 1914 | foreach($estadoData as $i=>$cED) |
| 1915 | { |
| 1916 | if ($desactiva_usuario != null and $pos_desactiva != null) { |
| 1917 | if ($cED['usuario_id'] == $desactiva_usuario and $cED['posicion'] == $pos_desactiva) { |
| 1918 | $cED['usuario_id'] = 0; |
| 1919 | $cED['activo'] = 'No'; |
| 1920 | } |
| 1921 | } |
| 1922 | $data = ""; |
| 1923 | $dataVal = ''; |
| 1924 | $tcStyle = 'style="width:40px !important; height:30px !important; display: flex; align-items: center; justify-content: center;'; |
| 1925 | if ($cED['usuario_id'] != 0 and $cED['activo'] != 'No') { |
| 1926 | $divRow = ''; |
| 1927 | $divRowEnd = ''; |
| 1928 | $cEDV = str_split($cED['valor']); |
| 1929 | $colores = json_decode($cED['color_extra'], true); |
| 1930 | if (!(($i-1)%$numCols)) { |
| 1931 | $divRow = '<div class="fila"></div>'; |
| 1932 | } |
| 1933 | |
| 1934 | foreach($cEDV as $j=>$cVal) |
| 1935 | { |
| 1936 | if ($cVal == 'Z' && $estadoValor[$j] == 'A') { // Asignado |
| 1937 | $dataVal = 'A'; |
| 1938 | $posicion = $j; |
| 1939 | $color = $colores['A']; |
| 1940 | $tcStyle .= "background: radial-gradient(circle, #FFFFFFFF 0%, #ffa2a2 10%, #ff0000 100%, $color[background] 100%); color: $color[color];"; |
| 1941 | } |
| 1942 | if ($cVal == 'Z' && $estadoValor[$j] == 'B') { // Revisado |
| 1943 | $dataVal = 'B'; |
| 1944 | $posicion = $j; |
| 1945 | $color = $colores['B']; |
| 1946 | $tcStyle .= "background: linear-gradient(90deg, rgba(255,255,255,1) 0%, rgba(36,196,33,1) 14%, $color[background] 64%, rgba(18,107,16,1) 100%); color:$color[color];"; |
| 1947 | } |
| 1948 | if ($cVal == 'Z' && $estadoValor[$j] == 'C') { // Autorizado |
| 1949 | $dataVal = 'C'; |
| 1950 | $posicion = $j; |
| 1951 | $color = $colores['C']; |
| 1952 | $tcStyle .= "background: radial-gradient(circle, #F3F9FF 0%, #EDF6FF 10%, $color[background] 100%); color: $color[color];"; |
| 1953 | } |
| 1954 | if ($cVal == 'Z' && $estadoValor[$j] == 'D') { // |
| 1955 | $dataVal = 'D'; |
| 1956 | $posicion = $j; |
| 1957 | $color = $colores['D']; |
| 1958 | // $tcStyle .= "background: radial-gradient(circle, rgba(181,89,89,1) 8%, $color[background] 85%, rgba(73,4,4,1) 96%); color: $color[color];"; |
| 1959 | $tcStyle .= "background: radial-gradient(circle, #FFFFFFFF 0%, #ffa2a2 10%, #ff0000 100%); color: $color[color];"; |
| 1960 | } |
| 1961 | if ($cVal == 'Z' && $estadoValor[$j] == 'C') { // Autorizado |
| 1962 | $dataVal = 'E'; |
| 1963 | $posicion = $j; |
| 1964 | $color = $colores['E']; |
| 1965 | $tcStyle .= "background: radial-gradient(circle, #ffa2fc 0%, #ffa2fc 10%, $color[background] 100%); color: $color[color];"; |
| 1966 | } |
| 1967 | if ($cVal == 'Z' && $estadoValor[$j] == 'Z') { // No asignado |
| 1968 | $dataVal = 'Z'; |
| 1969 | $posicion = $j; |
| 1970 | $color = $colores['Z']; |
| 1971 | $tcStyle .= "background: radial-gradient(circle, rgba(255,255,255,1) 30%, rgba(216,224,233,1) 77%); color: black;"; |
| 1972 | } |
| 1973 | } |
| 1974 | |
| 1975 | if ($con_eventos == true) { |
| 1976 | $title = $cED['descripcion']; |
| 1977 | if ($origen == 'banco_cuenta_mov_asignacion' || $origen == 'cuentat_gasto_asignacion') { |
| 1978 | if ($dataVal== 'B' || $dataVal== 'E' || $dataVal== 'C') { |
| 1979 | if (!empty($fecha_revision) and $posicion == $posicion_revision) { |
| 1980 | $title = "Revisado: ($fecha_revision)"; |
| 1981 | } else { |
| 1982 | $query = "SELECT revisado_el FROM asignacion WHERE cuentat_gasto_id = '$r_id' /*AND origen = '$origen_prefix'*/ AND posicion = $posicion"; |
| 1983 | $fecha = ia_singleread($query); |
| 1984 | if (!empty($fecha)) { |
| 1985 | $title = "Revisado: ($fecha)"; |
| 1986 | } |
| 1987 | } |
| 1988 | } else if($dataVal == 'A') { |
| 1989 | if (!empty($fecha_revision) and $posicion == $posicion_revision) { |
| 1990 | $title = "Asignado: ($fecha_revision)"; |
| 1991 | } else { |
| 1992 | $query = "SELECT date(alta_db) FROM asignacion WHERE cuentat_gasto_id = '$r_id' /*AND origen = '$origen_prefix'*/ AND posicion = $posicion"; |
| 1993 | // echo $query . " -> "; |
| 1994 | $fecha = ia_singleread($query); |
| 1995 | if (!empty($fecha)) { |
| 1996 | $title = "Asignado: ($fecha)"; |
| 1997 | } |
| 1998 | } |
| 1999 | } |
| 2000 | } |
| 2001 | // dd_($posicion, $posicion_revision); |
| 2002 | // echo $title . "<br>"; |
| 2003 | // exit; |
| 2004 | |
| 2005 | /*$data = "title=\"$title\" |
| 2006 | id=\"$i-$r_id\" |
| 2007 | data-pos=\"$i\" |
| 2008 | data-orden=\"$cED[orden]\" |
| 2009 | data-celval=\"$valor\" |
| 2010 | data-val=\"$dataVal\" |
| 2011 | data-user=\"$cED[usuario_id]\" |
| 2012 | data-estadovalor=\"$cED[valor]\" |
| 2013 | data-colname=\"asignacion\" |
| 2014 | data-rid=\"$r_id\" |
| 2015 | data-indexpos=\"$cED[posicion]\"";*/ |
| 2016 | |
| 2017 | $data = "title='$title' id='$i-$r_id' data-pos='$i' data-orden='$cED[orden]' data-celval='$valor' data-val='$dataVal' data-user='$cED[usuario_id]' data-estadovalor='$cED[valor]' data-colname='asignacion' data-rid='$r_id' data-indexpos='$cED[posicion]'"; |
| 2018 | $tcStyle .= 'cursor:inherit;'; |
| 2019 | |
| 2020 | $doble_click = ""; |
| 2021 | if ($activaDBLClick) |
| 2022 | $doble_click = "ondblclick=\"handleDBLClickAsignacion(this, $cED[posicion], `$r_id`, event)\""; |
| 2023 | |
| 2024 | $right_click = ""; |
| 2025 | if ($activaContextClick) |
| 2026 | $right_click = "oncontextmenu=\"handleContextClickAsignacion(this, $cED[posicion], `$r_id`); return false;\""; |
| 2027 | |
| 2028 | $eventos = "onmouseover=\"$(this).addClass(`ui-state-hover`);\" onmouseout=\"$(this).removeClass(`ui-state-hover`)\" onclick=\"handleClickAsignacion(this, `asignacion`, $cED[posicion], `$r_id`, event);\" $doble_click $right_click"; |
| 2029 | } |
| 2030 | |
| 2031 | $tcStyle .='"'; |
| 2032 | |
| 2033 | $divCell .= $divRow . "<div class=\"col-button asignacion\" $data $eventos><div $tcStyle><strong>$cED[clave]</strong></div></div>"; |
| 2034 | } |
| 2035 | } |
| 2036 | $div_table .= $divCell . '</div>'; |
| 2037 | return strim("<div>$div_table</div>"); |
| 2038 | } |
| 2039 | |
| 2040 | function async_all(){ |
| 2041 | @async_actualizaIngresos(); |
| 2042 | @async_mergeCtaTMovs(); |
| 2043 | @async_actualizaACuentasLive(); |
| 2044 | @async_actualizaFacturasCanceladas(); |
| 2045 | @async_actualizaFiduciariosAtrasados(); |
| 2046 | @async_actualizaGastosImportantes(); |
| 2047 | @async_actualizaWithdrawalsImportantes(); |
| 2048 | @async_actualizaInversionesAtrasadas(); |
| 2049 | @async_actualiza_clientes_saldos(); |
| 2050 | @async_generaCatalogos(); |
| 2051 | @async_actualizaLinksAlBancoLive(); |
| 2052 | @async_actualizaGastosPorRevisar(); |
| 2053 | } |
| 2054 | |
| 2055 | function fechaMysql2JS(&$fecha) |
| 2056 | { |
| 2057 | if(empty($fecha)) |
| 2058 | return ""; |
| 2059 | |
| 2060 | if(!is_array($fecha)) |
| 2061 | return date("d-m-Y",strtotime($fecha)); |
| 2062 | else |
| 2063 | { |
| 2064 | foreach($fecha as $k=>$v) |
| 2065 | { |
| 2066 | if(!empty($v) && strpos($k,"fecha")!== false) |
| 2067 | $fecha[$k]=date("d-m-Y",strtotime($v)); |
| 2068 | } |
| 2069 | |
| 2070 | return $fecha; |
| 2071 | } |
| 2072 | } |
| 2073 | |
| 2074 | function cmSelectValues($va, $id, $label=null) |
| 2075 | { |
| 2076 | if (empty($label)) |
| 2077 | $label = $id; |
| 2078 | $ret = "'':''"; |
| 2079 | foreach ($va as $v) |
| 2080 | $ret .= ",'" . $v[$id] . "':'" . $v[$label] . "'"; |
| 2081 | return $ret; |
| 2082 | } |
| 2083 | |
| 2084 | function activa_errores() { |
| 2085 | global $vx_debug; |
| 2086 | |
| 2087 | error_reporting(-1); |
| 2088 | ini_set('display_errors', 0); |
| 2089 | ini_set('display_startup_errors', 0); |
| 2090 | |
| 2091 | if(!$vx_debug) |
| 2092 | return; |
| 2093 | |
| 2094 | ini_set('display_errors', 1); |
| 2095 | ini_set('display_startup_errors', 1); |
| 2096 | ini_set('display_errors', 'On'); |
| 2097 | |
| 2098 | } |
| 2099 | function getTabsToAssignments() |
| 2100 | { |
| 2101 | $sql = "SELECT |
| 2102 | iac_usr_id usuario_id, nombre, |
| 2103 | puede_revisar_gastos_cuentaT, |
| 2104 | puede_revisar_movimientos_banco, |
| 2105 | puede_ser_supervisor_banco, |
| 2106 | puede_ser_supervisor, |
| 2107 | activa_alerta_gastos |
| 2108 | FROM iac_usr |
| 2109 | WHERE |
| 2110 | puede_revisar_gastos_cuentaT = 'Si' OR |
| 2111 | puede_revisar_movimientos_banco = 'Si' OR |
| 2112 | puede_ser_supervisor_banco = 'Si' OR |
| 2113 | puede_ser_supervisor = 'Si'"; |
| 2114 | $revisores_supervisores = ia_sqlArrayIndx($sql); |
| 2115 | $tabs = ""; |
| 2116 | foreach ($revisores_supervisores as $index => $user) { |
| 2117 | $tienePermisoBanco = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2118 | $puedeRevisarBanco = puedeRevisarGastosBanco($user['usuario_id']); |
| 2119 | $tienePermisoGCT = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2120 | $puedeRevisarGCT = puedeRevisarGastosCuentaT($user['usuario_id']); |
| 2121 | $blink = $user['activa_alerta_gastos'] == 'Si' ? 'blink_revisor': ''; |
| 2122 | if (($puedeRevisarBanco && $tienePermisoBanco !== false) || ($puedeRevisarGCT && $tienePermisoGCT !== false)) { |
| 2123 | $tabs .= "<li class='noselect $blink'> |
| 2124 | <a href='#gastos-$user[usuario_id]'>Gastos ". ucfirst(strtolower($user['nombre']))."</a> |
| 2125 | <button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id])' title='Activar/Desactivar alerta de gastos'></button> |
| 2126 | </li>"; |
| 2127 | } |
| 2128 | } |
| 2129 | return $tabs; |
| 2130 | } |
| 2131 | |
| 2132 | function getDivsToAssignments() |
| 2133 | { |
| 2134 | $sql = "SELECT |
| 2135 | iac_usr_id usuario_id, nombre, |
| 2136 | puede_revisar_gastos_cuentaT, |
| 2137 | puede_revisar_movimientos_banco, |
| 2138 | puede_ser_supervisor_banco, |
| 2139 | puede_ser_supervisor, |
| 2140 | activa_alerta_gastos |
| 2141 | FROM iac_usr |
| 2142 | WHERE |
| 2143 | puede_revisar_gastos_cuentaT = 'Si' OR |
| 2144 | puede_revisar_movimientos_banco = 'Si' OR |
| 2145 | puede_ser_supervisor_banco = 'Si' OR |
| 2146 | puede_ser_supervisor = 'Si'"; |
| 2147 | $revisores_supervisores = ia_sqlArrayIndx($sql); |
| 2148 | $divs = ""; |
| 2149 | foreach ($revisores_supervisores as $index => $user) { |
| 2150 | $tienePermisoBanco = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2151 | $puedeRevisarBanco = puedeRevisarGastosBanco($user['usuario_id']); |
| 2152 | $tienePermisoGCT = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2153 | $puedeRevisarGCT = puedeRevisarGastosCuentaT($user['usuario_id']); |
| 2154 | $link_retiros_banco = ""; |
| 2155 | $link_gastos_ct = ""; |
| 2156 | if (($puedeRevisarBanco && $tienePermisoBanco !== false) || ($puedeRevisarGCT && $tienePermisoGCT !== false)) { |
| 2157 | if ($puedeRevisarBanco && $tienePermisoBanco !== false) { |
| 2158 | $pos = obtenNumeroRevisorMovimientosBanco($user['usuario_id']); |
| 2159 | $link_retiros_banco = "<li><a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>Asignaciones de <span class='txt_bold_orange' >Widthrawals</span></a></li><br /> "; |
| 2160 | } |
| 2161 | if ($puedeRevisarGCT && $tienePermisoGCT !== false) { |
| 2162 | $pos = obtenNumeroRevisorGastosCuentaT($user['usuario_id']); |
| 2163 | $link_gastos_ct .= "<li><a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>Asignaciones de <span class='txt_bold_brightred' >Gastos de Cuenta T</span></a></li><br /> "; |
| 2164 | } |
| 2165 | $divs .= "<div id='gastos-$user[usuario_id]'> |
| 2166 | <ul class='tab'> |
| 2167 | $link_retiros_banco |
| 2168 | $link_gastos_ct |
| 2169 | </ul> |
| 2170 | </div>"; |
| 2171 | } |
| 2172 | } |
| 2173 | return $divs; |
| 2174 | } |
| 2175 | |
| 2176 | function getLinksToAssignments() |
| 2177 | { |
| 2178 | $sql = "SELECT |
| 2179 | iac_usr_id usuario_id, nombre, |
| 2180 | puede_revisar_gastos_cuentaT, |
| 2181 | puede_revisar_movimientos_banco, |
| 2182 | puede_ser_supervisor_banco, |
| 2183 | puede_ser_supervisor, |
| 2184 | activa_alerta_gastos |
| 2185 | FROM iac_usr |
| 2186 | WHERE |
| 2187 | puede_revisar_gastos_cuentaT = 'Si' OR |
| 2188 | puede_revisar_movimientos_banco = 'Si' OR |
| 2189 | puede_ser_supervisor_banco = 'Si' OR |
| 2190 | puede_ser_supervisor = 'Si'"; |
| 2191 | $revisores_supervisores = ia_sqlArrayIndx($sql); |
| 2192 | |
| 2193 | // dd_($revisores_supervisores); |
| 2194 | |
| 2195 | $likns_retiros_banco = ""; |
| 2196 | $likns_gastos_ct = ""; |
| 2197 | |
| 2198 | foreach ($revisores_supervisores as $index => $user) { |
| 2199 | // dd_($user['usuario_id']); |
| 2200 | $estado_revisor = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2201 | // puedeRevisarGastosBanco() && $estado_revisor !== false) |
| 2202 | if (puedeRevisarGastosBanco($user['usuario_id']) && $estado_revisor !== false) { |
| 2203 | // <a href="cuentat_gasto_list.php$usuarioTipoRony ? '':'?normal=SI';>Gastos de Cuenta T</a> |
| 2204 | $pos = obtenNumeroRevisorMovimientosBanco($user['usuario_id']); |
| 2205 | $likns_retiros_banco .= "<li><a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>Asignaciones de <span class='txt_bold_orange' >Widthrawals de $user[nombre]</span></a></li><br /> "; |
| 2206 | } |
| 2207 | $estado_revisor = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2208 | if (puedeRevisarGastosCuentaT($user['usuario_id']) && $estado_revisor !== false) { |
| 2209 | $pos = obtenNumeroRevisorGastosCuentaT($user['usuario_id']); |
| 2210 | $likns_gastos_ct .= "<li><a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>Asignaciones de <span class='txt_bold_brightred' >Gastos de Cuenta T de $user[nombre]</span></a></li><br /> "; |
| 2211 | } |
| 2212 | |
| 2213 | } |
| 2214 | |
| 2215 | // $li_s = "<li>LINK TO 1</li><br /> "; |
| 2216 | |
| 2217 | return (!empty($likns_retiros_banco) || !empty($likns_gastos_ct) ? "<hr style='width: 400px; border-top-color: lightcoral; border-right-color: lightcoral; border-bottom-color: lightcoral; border-left-color: lightcoral; background-color: lightcoral;' align='left'><br>" : "") . $likns_retiros_banco . $likns_gastos_ct; |
| 2218 | } |
| 2219 | |
| 2220 | function traeSupervisoresyRevisores($profile = null) |
| 2221 | { |
| 2222 | $where = ""; |
| 2223 | if ($profile == null) { |
| 2224 | $where = "puede_revisar_gastos_cuentaT = 'Si' OR |
| 2225 | puede_revisar_movimientos_banco = 'Si' OR |
| 2226 | puede_ser_supervisor_banco = 'Si' OR |
| 2227 | puede_ser_supervisor = 'Si'"; |
| 2228 | } elseif ($profile == 'revisor') { |
| 2229 | $where = "puede_revisar_gastos_cuentaT = 'Si' OR |
| 2230 | puede_revisar_movimientos_banco = 'Si'"; |
| 2231 | } elseif ($profile == 'supervisor') { |
| 2232 | $where = "puede_ser_supervisor_banco = 'Si' OR |
| 2233 | puede_ser_supervisor = 'Si'"; |
| 2234 | } |
| 2235 | |
| 2236 | $sql = "SELECT |
| 2237 | iac_usr_id usuario_id, nombre, |
| 2238 | puede_revisar_gastos_cuentaT, |
| 2239 | puede_revisar_movimientos_banco, |
| 2240 | puede_ser_supervisor_banco, |
| 2241 | puede_ser_supervisor, |
| 2242 | activa_alerta_gastos |
| 2243 | FROM iac_usr |
| 2244 | WHERE |
| 2245 | $where"; |
| 2246 | |
| 2247 | return ia_sqlArrayIndx($sql); |
| 2248 | } |
| 2249 | |
| 2250 | function traeSupervisoresRevisores($user_id = null, $profile = null, $full = false, $origen = null) |
| 2251 | { |
| 2252 | $function = __FUNCTION__; |
| 2253 | // if($profile == "revisor"){ |
| 2254 | // dd_($origen); |
| 2255 | // } |
| 2256 | $where_complete = ""; |
| 2257 | if ($user_id !== null) { |
| 2258 | // $us_id = $_SESSION['usuario_id']; |
| 2259 | $us_id = $user_id; |
| 2260 | $where[]= " usuario_id = $us_id"; |
| 2261 | } |
| 2262 | $where_complete_profile = ""; |
| 2263 | if ($profile != null) { |
| 2264 | $where[]= " (origen = '$profile')"; |
| 2265 | } |
| 2266 | $where_complete_origen = ""; |
| 2267 | if(!empty($origen)){ |
| 2268 | $where_complete_origen= " AND e.origen='$origen'"; |
| 2269 | } |
| 2270 | /* if ($profile == 'revisor') { |
| 2271 | $where_complete_profile = "WHERE puede_revisar_gastos_cuentaT = 'Si' OR puede_revisar_movimientos_banco = 'Si'"; |
| 2272 | } */ |
| 2273 | $where= implode(" AND ", $where); |
| 2274 | // echo |
| 2275 | $select = "SELECT /*$function*/ |
| 2276 | e.estado_id, |
| 2277 | e.usuario_id, e.clave, u.nombre, e.activo, e.posicion, e.valor, |
| 2278 | puede_revisar_gastos_cuentaT, |
| 2279 | puede_revisar_movimientos_banco, |
| 2280 | puede_ser_supervisor_banco, |
| 2281 | puede_ser_supervisor, |
| 2282 | -- activa_alerta_gastos, |
| 2283 | IF((e.origen = 'banco_cuenta_mov_asignacion' OR e.origen = 'cuentat_gasto_asignacion'), 'revisor', 'supervisor') origen, |
| 2284 | 'No' ya_esta |
| 2285 | FROM estado e |
| 2286 | join iac_usr u on u.iac_usr_id = e.usuario_id |
| 2287 | WHERE usuario_id != 0 AND activo = 'Si' $where_complete_origen"; |
| 2288 | |
| 2289 | if ($full == false) { |
| 2290 | $select = "SELECT /*$function*/* FROM ($select) asignaciones |
| 2291 | WHERE $where |
| 2292 | GROUP BY usuario_id, clave, origen |
| 2293 | ORDER BY usuario_id, origen"; |
| 2294 | } else { |
| 2295 | $select = "SELECT /*$function*/ * FROM ($select) asignaciones |
| 2296 | WHERE $where |
| 2297 | ORDER BY usuario_id, origen desc"; |
| 2298 | } |
| 2299 | // echo $select; |
| 2300 | // if($profile == "revisor"){ |
| 2301 | // dd_($select); |
| 2302 | // } |
| 2303 | return ia_sqlArrayIndx($select); |
| 2304 | } |
| 2305 | |
| 2306 | function getTableSupervisorsReviewers() |
| 2307 | { |
| 2308 | activa_errores(); |
| 2309 | // $revisores_supervisores = traeSupervisoresyRevisores(); |
| 2310 | // dd_(esRevisor()); |
| 2311 | $where_complete = ""; |
| 2312 | $es_revisor = esRevisor(); |
| 2313 | $us_id = null; |
| 2314 | if ($es_revisor) { |
| 2315 | $us_id = $_SESSION['usuario_id']; |
| 2316 | } |
| 2317 | |
| 2318 | $users = traeSupervisoresRevisores($us_id); |
| 2319 | // dd_($users); |
| 2320 | |
| 2321 | if (!empty($users)) { |
| 2322 | // $supervisores = isset($users['supervisor']) ? $users['supervisor'] : []; |
| 2323 | // $revisores = isset($users['revisor']) ? $users['revisor'] : []; |
| 2324 | |
| 2325 | // dd_($supervisores); |
| 2326 | |
| 2327 | // dd_($users); |
| 2328 | |
| 2329 | $td_supervisor_banco = ""; |
| 2330 | $td_supervisor_cuant_t = ""; |
| 2331 | $td_revisor_banco = ""; |
| 2332 | $td_revisor_cuenta_t = ""; |
| 2333 | $ya_estan = []; |
| 2334 | $key_search = ""; |
| 2335 | $showSupervisor = true; |
| 2336 | foreach ($users as $index => $user) { |
| 2337 | // $td_supervisor_banco .= ""; |
| 2338 | // $td_supervisor_cuant_t .= ""; |
| 2339 | $blink = $user['activa_alerta_gastos'] == 'Si' ? 'blink_revisor': ''; |
| 2340 | if (!in_array($user['usuario_id'], $ya_estan)) { |
| 2341 | if ($user['puede_ser_supervisor_banco'] == 'No' and $user['puede_ser_supervisor'] == 'No' and $es_revisor == true) { |
| 2342 | $showSupervisor = false; |
| 2343 | } |
| 2344 | if ($user['puede_ser_supervisor_banco'] == 'Si' and $user['puede_ser_supervisor'] == 'No') { |
| 2345 | $estado_revisor = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2346 | if (puedeRevisarGastosBanco($user['usuario_id']) && $estado_revisor !== false) { |
| 2347 | $pos = obtenNumeroRevisorMovimientosBanco($user['usuario_id']); |
| 2348 | $class_con_gastos = "sin-gastos"; |
| 2349 | $text_gastos= "Gastos de banco revisados"; |
| 2350 | if (tieneGastosPorRevisar($pos, 'banco_cuenta_mov')) { |
| 2351 | $class_con_gastos = "con-gastos"; |
| 2352 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2353 | } |
| 2354 | $td_supervisor_banco .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2355 | <a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2356 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2357 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2358 | </div>"; |
| 2359 | } |
| 2360 | } |
| 2361 | if ($user['puede_ser_supervisor_banco'] == 'No' and $user['puede_ser_supervisor'] == 'Si') { |
| 2362 | $estado_revisor = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2363 | if (puedeRevisarGastosCuentaT($user['usuario_id']) && $estado_revisor !== false) { |
| 2364 | $pos = obtenNumeroRevisorGastosCuentaT($user['usuario_id']); |
| 2365 | $class_con_gastos = "sin-gastos"; |
| 2366 | $text_gastos= "Gastos de Cuenat T revisados"; |
| 2367 | if (tieneGastosPorRevisar($pos, 'cuenta_t')) { |
| 2368 | $class_con_gastos = "con-gastos"; |
| 2369 | $text_gastos = "Tiene gastos de cuenta T por revisar"; |
| 2370 | } |
| 2371 | $td_supervisor_cuant_t .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2372 | <a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2373 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2374 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2375 | </div>"; |
| 2376 | } |
| 2377 | } |
| 2378 | if ($user['puede_ser_supervisor_banco'] == 'Si' and $user['puede_ser_supervisor'] == 'Si') { |
| 2379 | $estado_revisor = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2380 | if (puedeRevisarGastosBanco($user['usuario_id']) && $estado_revisor !== false) { |
| 2381 | $pos = obtenNumeroRevisorMovimientosBanco($user['usuario_id']); |
| 2382 | $class_con_gastos = "sin-gastos"; |
| 2383 | $text_gastos= "Gastos de banco revisados"; |
| 2384 | if (tieneGastosPorRevisar($pos, 'banco_cuenta_mov')) { |
| 2385 | $class_con_gastos = "con-gastos"; |
| 2386 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2387 | } |
| 2388 | $td_supervisor_banco .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2389 | <a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2390 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2391 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2392 | </div>"; |
| 2393 | } |
| 2394 | $estado_revisor = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2395 | if (puedeRevisarGastosCuentaT($user['usuario_id']) && $estado_revisor !== false) { |
| 2396 | $pos = obtenNumeroRevisorGastosCuentaT($user['usuario_id']); |
| 2397 | $class_con_gastos = "sin-gastos"; |
| 2398 | $text_gastos= "Gastos de Cuenat T revisados"; |
| 2399 | if (tieneGastosPorRevisar($pos, 'cuenta_t')) { |
| 2400 | $class_con_gastos = "con-gastos"; |
| 2401 | $text_gastos = "Tiene gastos de Cuenta T por revisar"; |
| 2402 | } |
| 2403 | $td_supervisor_cuant_t .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2404 | <a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2405 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2406 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2407 | </div>"; |
| 2408 | } |
| 2409 | } |
| 2410 | |
| 2411 | if ($user['puede_ser_supervisor_banco'] == 'No' and $user['puede_revisar_movimientos_banco'] == 'Si') { |
| 2412 | $estado_revisor = obtenEstadoRevisorMovimientosBancoPermission($user['usuario_id']); |
| 2413 | if (puedeRevisarGastosBanco($user['usuario_id']) && $estado_revisor !== false) { |
| 2414 | $pos = obtenNumeroRevisorMovimientosBanco($user['usuario_id']); |
| 2415 | $class_con_gastos = "sin-gastos"; |
| 2416 | $text_gastos= "Gastos de banco revisados"; |
| 2417 | if (tieneGastosPorRevisar($pos, 'banco_cuenta_mov')) { |
| 2418 | $class_con_gastos = "con-gastos"; |
| 2419 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2420 | } |
| 2421 | $td_revisor_banco .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2422 | <a class='bold ui-tabs-anchor' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2423 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2424 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2425 | </div>"; |
| 2426 | } |
| 2427 | } |
| 2428 | if ($user['puede_ser_supervisor'] == 'No' and $user['puede_revisar_gastos_cuentaT'] == 'Si') { |
| 2429 | $estado_revisor = obtenEstadoRevisorGastosCuentaTPermission($user['usuario_id']); |
| 2430 | if (puedeRevisarGastosCuentaT($user['usuario_id']) && $estado_revisor !== false) { |
| 2431 | $pos = obtenNumeroRevisorGastosCuentaT($user['usuario_id']); |
| 2432 | $class_con_gastos = "sin-gastos"; |
| 2433 | $text_gastos= "Gastos de Cuenta T revisados"; |
| 2434 | if (tieneGastosPorRevisar($pos, 'cuenta_t')) { |
| 2435 | $class_con_gastos = "con-gastos"; |
| 2436 | $text_gastos = "Tiene gastos de Cuenat T por revisar"; |
| 2437 | } |
| 2438 | $td_revisor_cuenta_t .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2439 | <a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[usuario_id]&pos=$pos'>$user[nombre]</a> |
| 2440 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2441 | <!--button type='button' class='btn-set-blink' onclick='setActiveAlert($user[usuario_id], false, this)' title='Activar/Desactivar alerta de gastos'></button--> |
| 2442 | </div>"; |
| 2443 | } |
| 2444 | } |
| 2445 | } |
| 2446 | array_push($ya_estan, $user['usuario_id']); |
| 2447 | } |
| 2448 | } |
| 2449 | $contentSupervisor = ""; |
| 2450 | if ($showSupervisor == true) { |
| 2451 | $contentSupervisor = "<div id='divSupervisor' class='cssAsignacion'> |
| 2452 | <span class='titlesSuperAsig'>Banco</span> |
| 2453 | <br><br> |
| 2454 | $td_supervisor_banco |
| 2455 | </div> |
| 2456 | <span class='upperTitle'>Supervisor</span> |
| 2457 | <div id='divAsginacion' class='cssSupervisor'> |
| 2458 | <span class='titlesSuperAsig'>Cuenta T</span> |
| 2459 | <br><br> |
| 2460 | $td_supervisor_cuant_t |
| 2461 | </div>"; |
| 2462 | } |
| 2463 | $divContent="<div class='divSuperAsig'> |
| 2464 | $contentSupervisor |
| 2465 | <div id='divSupervisor' class='cssAsignacion'> |
| 2466 | <span class='titlesSuperAsig'>Banco</span> |
| 2467 | <br><br> |
| 2468 | $td_revisor_banco |
| 2469 | </div> |
| 2470 | <span class='upperTitle'>Revisor</span> |
| 2471 | <div id='divAsginacion' class='cssSupervisorDer'> |
| 2472 | <span class='titlesSuperAsig'>Cuenta T</span> |
| 2473 | <br><br> |
| 2474 | $td_revisor_cuenta_t |
| 2475 | </div> |
| 2476 | </div>"; |
| 2477 | return $divContent; |
| 2478 | } |
| 2479 | |
| 2480 | function getTableSupervisorsReviewers_2() |
| 2481 | { |
| 2482 | |
| 2483 | // dd_($supervisores, $revisores); |
| 2484 | global $gIAParametros; |
| 2485 | $td_supervisor_banco = ""; |
| 2486 | $td_supervisor_cuant_t = ""; |
| 2487 | $td_revisor_banco = ""; |
| 2488 | $td_revisor_cuenta_t = ""; |
| 2489 | |
| 2490 | $es_revisor = (esRevisor() || esRevisorBanco()) ? true: false; |
| 2491 | |
| 2492 | if (usuarioTipoRony()) |
| 2493 | $es_revisor = false; |
| 2494 | |
| 2495 | if (!$es_revisor and !usuarioTipoRony()) return ''; |
| 2496 | |
| 2497 | $us_id = null; |
| 2498 | $where_complete = ""; |
| 2499 | if ($es_revisor) { |
| 2500 | $us_id = $_SESSION['usuario_id']; |
| 2501 | $where_complete = "AND campo_id = '$us_id'"; |
| 2502 | } |
| 2503 | $select = "SELECT * FROM campos_exists WHERE tabla_exists IN ('supervisor', 'revisor') $where_complete"; |
| 2504 | $users = ia_sqlArrayIndx($select); |
| 2505 | |
| 2506 | $suprvisores = []; |
| 2507 | $revisores = []; |
| 2508 | if (!empty($users)) { |
| 2509 | $users_2 = objetivisa_($users, 'tabla_exists'); |
| 2510 | $suprvisores = isset($users_2['supervisor']) ? $users_2['supervisor'] : []; |
| 2511 | $revisores = isset($users_2['revisor']) ? $users_2['revisor'] : []; |
| 2512 | } |
| 2513 | |
| 2514 | $tipos = []; |
| 2515 | $ya_esta_en_supervisor_banco = []; |
| 2516 | $ya_esta_en_supervisor_ct = []; |
| 2517 | |
| 2518 | $gatos_pendientes = 0; |
| 2519 | $today = date('Y-m-d'); |
| 2520 | |
| 2521 | $solo_es_supervisor = true; |
| 2522 | // $diff = date_diff(date_create('2021-07-01'), date_create($today)); |
| 2523 | // $dias = dateDifference('2021-07-01', $today, '%a'); |
| 2524 | // dd_($today, $dias, $dias>3); |
| 2525 | |
| 2526 | $supervisores = traeSupervisoresRevisores(null, 'supervisor', true); |
| 2527 | if (count($supervisores) > 0) { |
| 2528 | foreach ($suprvisores as $index => $user) { |
| 2529 | if ($user['activo'] == 'No') { continue;} |
| 2530 | array_push($tipos, $user['tabla_exists']); |
| 2531 | if ($user['tabla_exists'] == 'supervisor' and $user['tabla_origen'] == 'banco') { |
| 2532 | $class_con_gastos = "sin-gastos"; |
| 2533 | $text_gastos= "Gastos de banco revisados"; |
| 2534 | if ($user['valor'] != '0' || $user['valor'] != 0) { |
| 2535 | $class_con_gastos = "con-gastos"; |
| 2536 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2537 | } |
| 2538 | $span = ""; |
| 2539 | if (dateDifference($user['fecha'], $today, '%a') > $gIAParametros['dias_para_avisar_supervisor']) { |
| 2540 | $span = "<span type='button' class='$class_con_gastos' title='$text_gastos'></span>"; |
| 2541 | } |
| 2542 | $td_supervisor_banco .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2543 | <a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[campo_id]&pos=$user[posicion]&supervisor=SI'>$user[nombre]</a> |
| 2544 | $span |
| 2545 | </div><br>"; |
| 2546 | $key = $user['campo_id'] . "_" . $user['posicion']; |
| 2547 | array_push($ya_esta_en_supervisor_banco, $key); |
| 2548 | } |
| 2549 | if ($user['tabla_exists'] == 'supervisor' and $user['tabla_origen'] == 'cuenta_t') { |
| 2550 | $class_con_gastos = "sin-gastos"; |
| 2551 | $text_gastos= "Gastos de cuenta t revisados"; |
| 2552 | if ($user['valor'] != '0' || $user['valor'] != 0) { |
| 2553 | $class_con_gastos = "con-gastos"; |
| 2554 | $text_gastos = "Tiene gastos de cuenat t por revisar"; |
| 2555 | } |
| 2556 | $span = ""; |
| 2557 | if (dateDifference($user['fecha'], $today, '%a') > $gIAParametros['dias_para_avisar_supervisor']) { |
| 2558 | $span = "<span type='button' class='$class_con_gastos' title='$text_gastos'></span>"; |
| 2559 | } |
| 2560 | $td_supervisor_cuant_t .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2561 | <a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[campo_id]&pos=$user[posicion]&supervisor=SI'>$user[nombre]</a> |
| 2562 | $span |
| 2563 | </div><br>"; |
| 2564 | $key = $user['campo_id'] . "_" . $user['posicion']; |
| 2565 | array_push($ya_esta_en_supervisor_ct, $key); |
| 2566 | } |
| 2567 | } |
| 2568 | } |
| 2569 | |
| 2570 | |
| 2571 | $revisoresCount = traeSupervisoresRevisores(null, 'revisor', true); |
| 2572 | // echo "<pre>"; print_r($revisoresCount); echo "</pre>"; die(); |
| 2573 | if (count($revisoresCount) > 0) { |
| 2574 | foreach ($revisores as $index => $user) { |
| 2575 | if ($user['activo'] == 'No') { continue;} |
| 2576 | |
| 2577 | if ($es_revisor == true) { |
| 2578 | $solo_es_supervisor = false; |
| 2579 | } |
| 2580 | if ($user['tabla_exists'] == 'revisor' and $user['tabla_origen'] == 'banco') { |
| 2581 | $key = $user['campo_id'] . "_" . $user['posicion']; |
| 2582 | // dd_($ya_esta_en_supervisor_banco, $user); |
| 2583 | // if (!in_array($key, $ya_esta_en_supervisor_banco)) { |
| 2584 | if ($es_revisor == true) { |
| 2585 | $gatos_pendientes = $gatos_pendientes + intval($user['valor']); |
| 2586 | } |
| 2587 | $class_con_gastos = "sin-gastos"; |
| 2588 | $text_gastos= "Gastos de banco revisados"; |
| 2589 | if ($user['valor'] != '0' || $user['valor'] != 0) { |
| 2590 | $class_con_gastos = "con-gastos"; |
| 2591 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2592 | } |
| 2593 | $td_revisor_banco .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2594 | <a class='bold' href='withdrawals_de_banco_list.php?normal=NO&user_id=$user[campo_id]&pos=$user[posicion]'>$user[nombre]</a> |
| 2595 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2596 | </div><br>"; |
| 2597 | // } |
| 2598 | } |
| 2599 | if ($user['tabla_exists'] == 'revisor' and $user['tabla_origen'] == 'cuenta_t') { |
| 2600 | $key = $user['campo_id'] . "_" . $user['posicion']; |
| 2601 | // if (!in_array($key, $ya_esta_en_supervisor_ct)) { |
| 2602 | if ($es_revisor == true) { |
| 2603 | $gatos_pendientes = $gatos_pendientes + intval($user['valor']); |
| 2604 | } |
| 2605 | $class_con_gastos = "sin-gastos"; |
| 2606 | $text_gastos= "Gastos de banco revisados"; |
| 2607 | if ($user['valor'] != '0' || $user['valor'] != 0) { |
| 2608 | $class_con_gastos = "con-gastos"; |
| 2609 | $text_gastos = "Tiene gastos de banco por revisar"; |
| 2610 | } |
| 2611 | $td_revisor_cuenta_t .= "<div class='noselect ui-tabs-tab ui-corner-top ui-state-default ui-tab btn-asignacion'> |
| 2612 | <a class='bold' href='cuentat_gasto_list.php?normal=NO&user_id=$user[campo_id]&pos=$user[posicion]'>$user[nombre]</a> |
| 2613 | <span type='button' class='$class_con_gastos' title='$text_gastos'></span> |
| 2614 | </div><br>"; |
| 2615 | // } |
| 2616 | } |
| 2617 | |
| 2618 | } |
| 2619 | } |
| 2620 | |
| 2621 | |
| 2622 | $contentSupervisor = ""; |
| 2623 | $es_supervisor = false; |
| 2624 | if ($es_revisor == true) { |
| 2625 | if (in_array('supervisor', $tipos)) { |
| 2626 | $es_supervisor = true; |
| 2627 | if (count($supervisores) > 0) { |
| 2628 | $contentSupervisor = "<ul class='tab'> |
| 2629 | <div class='divSuperAsig'> |
| 2630 | <div id='divSupervisor' class='cssAsignacion'> |
| 2631 | <span class='titlesSuperAsig'>Banco</span> |
| 2632 | <br><br> |
| 2633 | $td_supervisor_banco |
| 2634 | </div> |
| 2635 | <span class='upperTitle'>Supervisor</span> |
| 2636 | <div id='divAsginacion' class='cssSupervisorDer'> |
| 2637 | <span class='titlesSuperAsig'>Cuenta T</span> |
| 2638 | <br><br> |
| 2639 | $td_supervisor_cuant_t |
| 2640 | </div> |
| 2641 | </div> |
| 2642 | </ul>"; |
| 2643 | } |
| 2644 | } |
| 2645 | } else { |
| 2646 | if (count($supervisores) > 0) { |
| 2647 | $contentSupervisor = "<ul class='tab'> |
| 2648 | <div class='divSuperAsig'> |
| 2649 | <div id='divSupervisor' class='cssAsignacion'> |
| 2650 | <span class='titlesSuperAsig'>Banco</span> |
| 2651 | <br><br> |
| 2652 | $td_supervisor_banco |
| 2653 | </div> |
| 2654 | <span class='upperTitle'>Supervisor</span> |
| 2655 | <div id='divAsginacion' class='cssSupervisorDer'> |
| 2656 | <span class='titlesSuperAsig'>Cuenta T</span> |
| 2657 | <br><br> |
| 2658 | $td_supervisor_cuant_t |
| 2659 | </div> |
| 2660 | </div> |
| 2661 | </ul>"; |
| 2662 | } |
| 2663 | } |
| 2664 | if (count($revisoresCount) > 0) { |
| 2665 | $contentRevisor ="<ul class='tab'> |
| 2666 | <div class='divSuperAsig'> |
| 2667 | <div id='divSupervisor' class='cssAsignacion'> |
| 2668 | <span class='titlesSuperAsig'>Banco</span> |
| 2669 | <br><br> |
| 2670 | $td_revisor_banco |
| 2671 | </div> |
| 2672 | <span class='upperTitle'>Revisor</span> |
| 2673 | <div id='divAsginacion' class='cssSupervisor'> |
| 2674 | <span class='titlesSuperAsig'>Cuenta T</span> |
| 2675 | <br><br> |
| 2676 | $td_revisor_cuenta_t |
| 2677 | </div> |
| 2678 | </div> |
| 2679 | </ul>"; |
| 2680 | } else { |
| 2681 | $contentRevisor = ''; |
| 2682 | } |
| 2683 | |
| 2684 | if (count($revisoresCount) === 0 and count($supervisores) === 0) { |
| 2685 | $divContent = ''; |
| 2686 | } else { |
| 2687 | $divContent="<style>.conFlex{ display: flex; gap: 2em; }</style><div class='conFlex'> |
| 2688 | $contentRevisor |
| 2689 | $contentSupervisor |
| 2690 | </div> |
| 2691 | "; |
| 2692 | } |
| 2693 | |
| 2694 | $es_revisor = ($es_revisor) ? 'true': 'false'; |
| 2695 | $es_supervisor = ($es_supervisor) ? 'true': 'false'; |
| 2696 | $solo_es_supervisor = ($solo_es_supervisor) ? 'true': 'false'; |
| 2697 | echo <<<TAB_Blink_Gastos |
| 2698 | <script> |
| 2699 | var es_revisor = $es_revisor, |
| 2700 | gastos_pendientes = $gatos_pendientes, |
| 2701 | es_supervisor = $es_supervisor, |
| 2702 | solo_es_supevisor = $solo_es_supervisor; |
| 2703 | $(() => { |
| 2704 | // console.log(es_revisor, gastos_pendientes); |
| 2705 | if (es_revisor == true && gastos_pendientes > 0 && !es_supervisor) { |
| 2706 | $('#tab-gastos').append("<span type='button' class='con-gastos'></span>"); |
| 2707 | } |
| 2708 | if (es_revisor == true && gastos_pendientes > 0 && !solo_es_supevisor) { |
| 2709 | $('#tab-gastos').append("<span type='button' class='con-gastos'></span>"); |
| 2710 | } |
| 2711 | }); |
| 2712 | </script> |
| 2713 | TAB_Blink_Gastos; |
| 2714 | return $divContent; |
| 2715 | } |
| 2716 | |
| 2717 | function getPosEstado($id) |
| 2718 | { |
| 2719 | $query = "SELECT * FROM estado WHERE estado_id = '$id'"; |
| 2720 | $estado = ia_singleton($query); |
| 2721 | if (empty($estado)){ |
| 2722 | return false; |
| 2723 | } |
| 2724 | return strpos($estado['valor'], 'Z'); |
| 2725 | } |
| 2726 | |
| 2727 | function parseClauseIn($keys = []) |
| 2728 | { |
| 2729 | $in_clause = ''; |
| 2730 | foreach ($keys as $key) { |
| 2731 | $in_clause.= strit($key) . ", "; |
| 2732 | } |
| 2733 | if(strlen($in_clause)) |
| 2734 | $in_clause = substr($in_clause, 0, -2); |
| 2735 | if(empty($in_clause)) |
| 2736 | $in_clause = "'\t'"; |
| 2737 | return $in_clause; |
| 2738 | } |
| 2739 | |
| 2740 | function calculaEstadoDispobible ($origen) |
| 2741 | { |
| 2742 | $query = "SELECT * FROM estado WHERE origen = '$origen' ORDER BY orden ASC"; |
| 2743 | $estados = ia_sqlArrayIndx($query); |
| 2744 | if (!empty($estados)) { |
| 2745 | foreach ($estados as $item => $estado) { |
| 2746 | if ($estado['usuario_id'] == '0' || $estado['usuario_id'] == 0) { |
| 2747 | return $estado['estado_id']; |
| 2748 | break; |
| 2749 | } |
| 2750 | } |
| 2751 | } |
| 2752 | } |
| 2753 | |
| 2754 | function haz_update ($campos, $table, $pkField) |
| 2755 | { |
| 2756 | $set_s = ""; |
| 2757 | if (empty($campos)) return ''; |
| 2758 | |
| 2759 | foreach ($campos as $campo => $valor) { |
| 2760 | if ($campo != $pkField) { |
| 2761 | $set_s .= fieldit($campo) . '=' . strit($valor) . ', '; |
| 2762 | } |
| 2763 | } |
| 2764 | $set_s = substr($set_s, 0, -2); |
| 2765 | $id = $campos[$pkField]; |
| 2766 | return "UPDATE $table SET $set_s WHERE $pkField = '$id'"; |
| 2767 | } |
| 2768 | |
| 2769 | function countUserEstado($origen, $user) |
| 2770 | { |
| 2771 | $sql = "SELECT count(*) conteo FROM estado WHERE origen = '$origen' AND usuario_id = '$user'"; |
| 2772 | |
| 2773 | return ia_singleread($sql); |
| 2774 | } |
| 2775 | |
| 2776 | function tieneGastosPorRevisar($pos, $origen, $return_total = false) |
| 2777 | { |
| 2778 | $estado_base = '____________'; |
| 2779 | $like_asignado = $estado_base; |
| 2780 | $like_rechazado = $estado_base; |
| 2781 | |
| 2782 | $like_asignado[$pos] = 'A'; |
| 2783 | $like_rechazado[$pos] = 'D'; |
| 2784 | if ($origen == 'cuenta_t') { |
| 2785 | $select = "SELECT count(*) totales FROM cuentat_gasto WHERE (asignacion LIKE '%$like_asignado%' OR asignacion LIKE '%$like_rechazado%') AND activo = 'Si'"; |
| 2786 | } else { |
| 2787 | $select = "SELECT count(*) totales FROM banco_cuenta_mov WHERE (asignacion LIKE '%$like_asignado%' OR asignacion LIKE '%$like_rechazado%') AND es = 'retiro'"; |
| 2788 | } |
| 2789 | // dd_($select, $origen); |
| 2790 | $count = ia_singleread($select); |
| 2791 | |
| 2792 | if ($return_total == true) return $count; |
| 2793 | |
| 2794 | if ($count > 0) return true; |
| 2795 | |
| 2796 | return false; |
| 2797 | } |
| 2798 | |
| 2799 | function getMinimumAssignmentDate($user_id, $origen, $posicion) |
| 2800 | { |
| 2801 | $query = "SELECT DATE(MIN(alta_db)) fecha FROM asignacion WHERE usuario_id = $user_id AND origen = '$origen' AND posicion = $posicion AND estatus_revision = 'A' ORDER BY alta_db"; |
| 2802 | |
| 2803 | return ia_singleread($query); |
| 2804 | } |
| 2805 | |
| 2806 | function dateDifference($date_1 , $date_2 , $differenceFormat = '%y Year %m Month %d Day' ) |
| 2807 | { |
| 2808 | // '%y Year %m Month %d Day' => 1 Year 3 Month 14 Days |
| 2809 | // '%m Month %d Day' => 3 Month 14 Day |
| 2810 | // '%d Day %h Hours' => 14 Day 11 Hours |
| 2811 | // '%d Day' => 14 Days |
| 2812 | // '%h Hours %i Minute %s Seconds' => 11 Hours 49 Minute 36 Seconds |
| 2813 | // '%i Minute %s Seconds' => 49 Minute 36 Seconds |
| 2814 | // '%h Hours => 11 Hours |
| 2815 | // '%a Days => 468 Days |
| 2816 | $datetime1 = date_create($date_1); |
| 2817 | $datetime2 = date_create($date_2); |
| 2818 | |
| 2819 | $interval = date_diff($datetime1, $datetime2); |
| 2820 | |
| 2821 | return $interval->format($differenceFormat); |
| 2822 | } |
| 2823 | |
| 2824 | |
| 2825 | function objetivisa_($datos, $key){ |
| 2826 | $regresa = []; |
| 2827 | if($datos != null){ |
| 2828 | foreach ($datos as $d) { |
| 2829 | $indice = normaliza_($d[$key] ?? ''); |
| 2830 | $regresa[$indice][] = $d; |
| 2831 | } |
| 2832 | } |
| 2833 | return $regresa; |
| 2834 | } |
| 2835 | function normaliza_($cadena){ |
| 2836 | $originales = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ'; |
| 2837 | $modificadas = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr'; |
| 2838 | // $cadena = utf8_decode($cadena); //PHP 8.2 |
| 2839 | $cadena = mb_convert_encoding($cadena, 'ISO-8859-1', 'UTF-8'); |
| 2840 | $cadena = str_replace($originales, $modificadas, $cadena); |
| 2841 | // $cadena = strtolower($cadena); |
| 2842 | // return utf8_encode($cadena); PHP 8.2 |
| 2843 | return mb_convert_encoding($cadena, 'UTF-8', 'ISO-8859-1'); |
| 2844 | } |
| 2845 | |
| 2846 | function obten_array_norm_doctos(){ |
| 2847 | |
| 2848 | return $normalize=array( |
| 2849 | 'cheque'=>array( |
| 2850 | 'tabla'=>'cheque', |
| 2851 | 'from'=> "(cheque left join cliente on((cheque.cliente_id = cliente.cliente_id)) left join categoria on((cheque.categoria_id = categoria.categoria_id)))", |
| 2852 | 'where' => "", |
| 2853 | 'tienda_id'=>'cheque.tienda_id', |
| 2854 | 'moneda_id'=>'cheque.moneda_id', |
| 2855 | 'numero'=>'cheque.numero', |
| 2856 | 'cliente_id' => 'cheque.cliente_id', |
| 2857 | 'cliente' => 'cliente.nombre', |
| 2858 | 'fecha' => 'if((cheque.new_date is null),cheque.original_date,cheque.new_date)', |
| 2859 | 'alta_db'=>'cheque.alta_db', |
| 2860 | 'alta_por' => 'cheque.alta_por', |
| 2861 | 'quantity' => 'cheque.quantity', |
| 2862 | 'total_payments'=>'cheque.total_payments', |
| 2863 | 'debe' => 'if(((cheque.quantity - cheque.total_payments) < 0),0,(cheque.quantity - cheque.total_payments))', |
| 2864 | 'saldo' => 'if((cheque.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 2865 | 'cuentaT_deliveredto_id'=>'cheque.cuentaT_deliveredto_id', |
| 2866 | 'origen_cuentat_id' => 'cheque.origen_cuentat_id', |
| 2867 | 'numero_sistema' => 'cheque.numero_sistema', |
| 2868 | 'remarks'=>'cheque.remarks', |
| 2869 | 'autorizado' => 'cheque.autorizado', |
| 2870 | 'autorizado_por' => 'cheque.autorizado_por', |
| 2871 | 'autorizado_el' => 'cheque.autorizado_el', |
| 2872 | 'borrado' => 'cheque.borrado', |
| 2873 | 'borrado_por' => 'cheque.borrado_por', |
| 2874 | 'borrado_el' => 'cheque.borrado_el', |
| 2875 | 'doc_id' => 'cheque.cheque_id', |
| 2876 | 'doc_origen_id' => 'cheque.cheque_id', |
| 2877 | 'origen' => "if((((cheque.origen_cuentat_id is null) or (cheque.origen_cuentat_id = '')) and (cheque.delivered_directo = '1' OR cuentaT_transferto_id > 0 OR cuentaT_deliveredto_id > 0)),'CHEQUE DD','CHEQUE')", |
| 2878 | 'paid' => 'cheque.paid', |
| 2879 | 'delivered_directo' => 'cheque.delivered_directo', |
| 2880 | 'ultimo_movimiento' => 'cheque.ultimo_movimiento', |
| 2881 | 'desautorizado_el' => 'cheque.desautorizado_el', |
| 2882 | 'numero_contenedor' => 'cheque.numero_contenedor', |
| 2883 | 'lugar_de_entrada' => 'cheque.lugar_de_entrada', |
| 2884 | 'tipo_de_tela' => 'cheque.tipo_de_tela', |
| 2885 | 'banco_cuenta_id' => '0', |
| 2886 | 'deposit_fecha' => 'NULL', |
| 2887 | 'deposit_total' => '0', |
| 2888 | 'doc_moneda' => 'cheque.moneda_id', |
| 2889 | 'remarks_wot' => 'cheque.remarks_wot', |
| 2890 | 'cuentat_mov_id' => 'cheque.cuentat_mov_id', |
| 2891 | 'acta_quantity' => '0', |
| 2892 | 'rechazado' => 'cheque.rechazado', |
| 2893 | 'categoria_id' => 'cheque.categoria_id', |
| 2894 | 'categoria' => 'categoria.categoria', |
| 2895 | 'tipo' => 'cheque.tipo', |
| 2896 | 'paid_when' => 'cheque.paid_when', |
| 2897 | 'ultimo_pago' => 'cheque.ultimo_pago', |
| 2898 | 'tipo_cambio' => '0.00', |
| 2899 | ), |
| 2900 | 'cheque_log'=>array( |
| 2901 | 'tabla'=>'cheque_log', |
| 2902 | 'from'=> "(cheque_log LEFT JOIN cliente ON((cheque_log.cliente_id = cliente.cliente_id)) left join categoria on((cheque_log.categoria_id = categoria.categoria_id)))", |
| 2903 | 'where' => "", |
| 2904 | 'tienda_id'=>'cheque_log.tienda_id', |
| 2905 | 'moneda_id'=>'cheque_log.moneda_id', |
| 2906 | 'numero'=>'cheque_log.numero', |
| 2907 | 'cliente_id' => 'cheque_log.cliente_id', |
| 2908 | 'cliente' => 'cliente.nombre', |
| 2909 | 'fecha' => 'if((cheque_log.new_date is null),cheque_log.original_date,cheque_log.new_date)', |
| 2910 | 'alta_db'=>'cheque_log.alta_db', |
| 2911 | 'alta_por' => 'cheque_log.alta_por', |
| 2912 | 'quantity' => 'cheque_log.quantity', |
| 2913 | 'total_payments'=>'cheque_log.total_payments', |
| 2914 | 'debe' => 'if(((cheque_log.quantity - cheque_log.total_payments) < 0),0,(cheque_log.quantity - cheque_log.total_payments))', |
| 2915 | 'saldo' => 'if((cheque_log.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 2916 | 'cuentaT_deliveredto_id'=>'cheque_log.cuentaT_deliveredto_id', |
| 2917 | 'origen_cuentat_id' => 'cheque_log.origen_cuentat_id', |
| 2918 | 'numero_sistema' => 'cheque_log.numero_sistema', |
| 2919 | 'remarks'=>'cheque_log.remarks', |
| 2920 | 'autorizado' => 'cheque_log.autorizado', |
| 2921 | 'autorizado_por' => 'cheque_log.autorizado_por', |
| 2922 | 'autorizado_el' => 'cheque_log.autorizado_el', |
| 2923 | 'borrado' => 'cheque_log.borrado', |
| 2924 | 'borrado_por' => 'cheque_log.borrado_por', |
| 2925 | 'borrado_el' => 'cheque_log.borrado_el', |
| 2926 | 'doc_id' => 'cheque_log.cheque_id', |
| 2927 | 'doc_origen_id' => 'cheque_log.cheque_id', |
| 2928 | 'origen' => "if((((cheque_log.origen_cuentat_id is null) or (cheque_log.origen_cuentat_id = '')) and (cheque_log.delivered_directo = '1' OR cuentaT_transferto_id > 0 OR cuentaT_deliveredto_id > 0)),'CHEQUE DD','CHEQUE')", |
| 2929 | 'paid' => 'cheque_log.paid', |
| 2930 | 'delivered_directo' => 'cheque_log.delivered_directo', |
| 2931 | 'ultimo_movimiento' => 'cheque_log.ultimo_movimiento', |
| 2932 | 'desautorizado_el' => 'cheque_log.desautorizado_el', |
| 2933 | 'numero_contenedor' => 'cheque_log.numero_contenedor', |
| 2934 | 'lugar_de_entrada' => 'cheque_log.lugar_de_entrada', |
| 2935 | 'tipo_de_tela' => 'cheque_log.tipo_de_tela', |
| 2936 | 'banco_cuenta_id' => '0', |
| 2937 | 'deposit_fecha' => 'NULL', |
| 2938 | 'deposit_total' => '0', |
| 2939 | 'doc_moneda' => 'cheque_log.moneda_id', |
| 2940 | 'remarks_wot' => 'cheque_log.remarks_wot', |
| 2941 | 'cuentat_mov_id' => 'cheque_log.cuentat_mov_id', |
| 2942 | 'acta_quantity' => '0', |
| 2943 | 'rechazado' => 'cheque_log.rechazado', |
| 2944 | 'categoria_id' => 'cheque_log.categoria_id', |
| 2945 | 'categoria' => 'categoria.categoria', |
| 2946 | 'tipo' => 'cheque_log.tipo', |
| 2947 | 'paid_when' => 'cheque_log.paid_when', |
| 2948 | 'ultimo_pago' => 'NULL', |
| 2949 | 'tipo_cambio' => '0.00', |
| 2950 | ), |
| 2951 | 'pagare'=>array( |
| 2952 | 'tabla'=>'pagare', |
| 2953 | 'from'=> "(pagare LEFT JOIN cliente ON((pagare.cliente_id = cliente.cliente_id)) left join categoria on((pagare.categoria_id = categoria.categoria_id)))", |
| 2954 | 'where' => "", |
| 2955 | 'tienda_id'=>'pagare.tienda_id', |
| 2956 | 'moneda_id'=>'pagare.moneda_id', |
| 2957 | 'numero'=>'pagare.numero', |
| 2958 | 'cliente_id' => 'pagare.cliente_id', |
| 2959 | 'cliente' => 'cliente.nombre', |
| 2960 | 'fecha' => 'if((pagare.new_date is null),pagare.original_date,pagare.new_date)', |
| 2961 | 'alta_db'=>'pagare.alta_db', |
| 2962 | 'alta_por' => 'pagare.alta_por', |
| 2963 | 'quantity' => 'pagare.quantity', |
| 2964 | 'total_payments'=>'pagare.total_payments', |
| 2965 | 'debe' => 'if(((pagare.quantity - pagare.total_payments) < 0),0,(pagare.quantity - pagare.total_payments))', |
| 2966 | 'saldo' => 'if((pagare.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 2967 | 'cuentaT_deliveredto_id'=>'pagare.cuentaT_deliveredto_id', |
| 2968 | 'origen_cuentat_id' => 'pagare.origen_cuentat_id', |
| 2969 | 'numero_sistema' => 'pagare.numero_sistema', |
| 2970 | 'remarks'=>'pagare.remarks', |
| 2971 | 'autorizado' => 'pagare.autorizado', |
| 2972 | 'autorizado_por' => 'pagare.autorizado_por', |
| 2973 | 'autorizado_el' => 'pagare.autorizado_el', |
| 2974 | 'borrado' => 'pagare.borrado', |
| 2975 | 'borrado_por' => 'pagare.borrado_por', |
| 2976 | 'borrado_el' => 'pagare.borrado_el', |
| 2977 | 'doc_id' => 'pagare.pagare_id', |
| 2978 | 'doc_origen_id' => 'pagare.pagare_id', |
| 2979 | 'origen' => "'PAGARE'", |
| 2980 | 'paid' => 'pagare.paid', |
| 2981 | 'delivered_directo' => 'pagare.delivered_directo', |
| 2982 | 'ultimo_movimiento' => 'pagare.ultimo_movimiento', |
| 2983 | 'desautorizado_el' => 'pagare.desautorizado_el', |
| 2984 | 'numero_contenedor' => 'pagare.numero_contenedor', |
| 2985 | 'lugar_de_entrada' => 'pagare.lugar_de_entrada', |
| 2986 | 'tipo_de_tela' => 'pagare.tipo_de_tela', |
| 2987 | 'banco_cuenta_id' => '0', |
| 2988 | 'deposit_fecha' => 'NULL', |
| 2989 | 'deposit_total' => '0', |
| 2990 | 'doc_moneda' => 'pagare.moneda_id', |
| 2991 | 'remarks_wot' => 'pagare.remarks_wot', |
| 2992 | 'cuentat_mov_id' => 'pagare.cuentat_mov_id', |
| 2993 | 'acta_quantity' => '0', |
| 2994 | 'rechazado' => 'pagare.rechazado', |
| 2995 | 'categoria_id' => 'pagare.categoria_id', |
| 2996 | 'categoria' => 'categoria.categoria', |
| 2997 | 'tipo' => 'pagare.tipo', |
| 2998 | 'paid_when' => 'pagare.paid_when', |
| 2999 | 'ultimo_pago' => 'pagare.ultimo_pago', |
| 3000 | 'tipo_cambio' => '0.00', |
| 3001 | ), |
| 3002 | 'pagare_log'=>array( |
| 3003 | 'tabla'=>'pagare_log', |
| 3004 | 'from'=> "(pagare_log LEFT JOIN cliente ON((pagare_log.cliente_id = cliente.cliente_id)) left join categoria on((pagare_log.categoria_id = categoria.categoria_id)))", |
| 3005 | 'where' => "", |
| 3006 | 'tienda_id'=>'pagare_log.tienda_id', |
| 3007 | 'moneda_id'=>'pagare_log.moneda_id', |
| 3008 | 'numero'=>'pagare_log.numero', |
| 3009 | 'cliente_id' => 'pagare_log.cliente_id', |
| 3010 | 'cliente' => 'cliente.nombre', |
| 3011 | 'fecha' => 'if((pagare_log.new_date is null),pagare_log.original_date,pagare_log.new_date)', |
| 3012 | 'alta_db'=>'pagare_log.alta_db', |
| 3013 | 'alta_por' => 'pagare_log.alta_por', |
| 3014 | 'quantity' => 'pagare_log.quantity', |
| 3015 | 'total_payments'=>'pagare_log.total_payments', |
| 3016 | 'debe' => 'if(((pagare_log.quantity - pagare_log.total_payments) < 0),0,(pagare_log.quantity - pagare_log.total_payments))', |
| 3017 | 'saldo' => 'if((pagare_log.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 3018 | 'cuentaT_deliveredto_id'=>'pagare_log.cuentaT_deliveredto_id', |
| 3019 | 'origen_cuentat_id' => 'pagare_log.origen_cuentat_id', |
| 3020 | 'numero_sistema' => 'pagare_log.numero_sistema', |
| 3021 | 'remarks'=>'pagare_log.remarks', |
| 3022 | 'autorizado' => 'pagare_log.autorizado', |
| 3023 | 'autorizado_por' => 'pagare_log.autorizado_por', |
| 3024 | 'autorizado_el' => 'pagare_log.autorizado_el', |
| 3025 | 'borrado' => 'pagare_log.borrado', |
| 3026 | 'borrado_por' => 'pagare_log.borrado_por', |
| 3027 | 'borrado_el' => 'pagare_log.borrado_el', |
| 3028 | 'doc_id' => 'pagare_log.pagare_id', |
| 3029 | 'doc_origen_id' => 'pagare_log.pagare_id', |
| 3030 | 'origen' => "'PAGARE'", |
| 3031 | 'paid' => 'pagare_log.paid', |
| 3032 | 'delivered_directo' => 'pagare_log.delivered_directo', |
| 3033 | 'ultimo_movimiento' => 'pagare_log.ultimo_movimiento', |
| 3034 | 'desautorizado_el' => 'pagare_log.desautorizado_el', |
| 3035 | 'numero_contenedor' => 'pagare_log.numero_contenedor', |
| 3036 | 'lugar_de_entrada' => 'pagare_log.lugar_de_entrada', |
| 3037 | 'tipo_de_tela' => 'pagare_log.tipo_de_tela', |
| 3038 | 'banco_cuenta_id' => '0', |
| 3039 | 'deposit_fecha' => 'NULL', |
| 3040 | 'deposit_total' => '0', |
| 3041 | 'doc_moneda' => 'pagare_log.moneda_id', |
| 3042 | 'remarks_wot' => 'pagare_log.remarks_wot', |
| 3043 | 'cuentat_mov_id' => 'pagare_log.cuentat_mov_id', |
| 3044 | 'acta_quantity' => '0', |
| 3045 | 'rechazado' => 'pagare_log.rechazado', |
| 3046 | 'categoria_id' => 'pagare_log.categoria_id', |
| 3047 | 'categoria' => 'categoria.categoria', |
| 3048 | 'tipo' => 'pagare_log.tipo', |
| 3049 | 'paid_when' => 'pagare_log.paid_when', |
| 3050 | 'ultimo_pago' => 'NULL', |
| 3051 | 'tipo_cambio' => '0.00', |
| 3052 | ), |
| 3053 | 'vale'=>array( |
| 3054 | 'tabla'=>'vale', |
| 3055 | 'from'=> "(vale left join cliente on((vale.cliente_id = cliente.cliente_id)) left join categoria on((vale.categoria_id = categoria.categoria_id)))", |
| 3056 | 'where' => "", |
| 3057 | 'tienda_id'=>'vale.tienda_id', |
| 3058 | 'moneda_id'=>'vale.moneda_id', |
| 3059 | 'numero'=>'vale.vale_number', |
| 3060 | 'cliente_id' => 'vale.cliente_id', |
| 3061 | 'cliente' => 'if((vale.cliente_id is null), vale.cliente, cliente.nombre)', |
| 3062 | 'fecha' => 'vale.fecha', |
| 3063 | 'alta_db'=>'vale.alta_db', |
| 3064 | 'alta_por' => 'vale.alta_por', |
| 3065 | 'quantity' => 'vale.quantity', |
| 3066 | 'total_payments'=>'vale.total_payments', |
| 3067 | 'debe' => 'if(((vale.quantity - vale.total_payments) < 0),0,(vale.quantity - vale.total_payments))', |
| 3068 | 'saldo' => 'if((vale.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 3069 | 'cuentaT_deliveredto_id'=>'vale.dinero_en_cuentaT_id', |
| 3070 | 'origen_cuentat_id' => 'vale.dinero_en_cuentaT_id', |
| 3071 | 'numero_sistema' => 'vale.numero_sistema', |
| 3072 | 'remarks'=>'vale.remarks', |
| 3073 | 'autorizado' => 'vale.autorizado', |
| 3074 | 'autorizado_por' => 'vale.autorizado_por', |
| 3075 | 'autorizado_el' => 'vale.autorizado_el', |
| 3076 | 'borrado' => 'vale.borrado', |
| 3077 | 'borrado_por' => 'vale.borrado_por', |
| 3078 | 'borrado_el' => 'vale.borrado_el', |
| 3079 | 'doc_id' => 'vale.vale_id', |
| 3080 | 'doc_origen_id' => 'vale.vale_id', |
| 3081 | 'origen' => "'VALE'", |
| 3082 | 'paid' => 'vale.paid', |
| 3083 | 'delivered_directo' => '0', |
| 3084 | 'ultimo_movimiento' => 'vale.ultimo_movimiento', |
| 3085 | 'desautorizado_el' => 'vale.desautorizado_el', |
| 3086 | 'numero_contenedor' => 'vale.numero_contenedor', |
| 3087 | 'lugar_de_entrada' => 'vale.lugar_de_entrada', |
| 3088 | 'tipo_de_tela' => 'vale.tipo_de_tela', |
| 3089 | 'banco_cuenta_id' => 'vale.banco_cuenta_id', |
| 3090 | 'deposit_fecha' => 'vale.deposit_fecha', |
| 3091 | 'deposit_total' => 'vale.deposit_total', |
| 3092 | 'doc_moneda' => 'vale.moneda_id', |
| 3093 | 'remarks_wot' => 'vale.remarks_wot', |
| 3094 | 'cuentat_mov_id' => 'vale.cuenta_t_mov_id', |
| 3095 | 'acta_quantity' => '0', |
| 3096 | 'rechazado' => 'vale.rechazado', |
| 3097 | 'categoria_id' => 'vale.categoria_id', |
| 3098 | 'categoria' => 'categoria.categoria', |
| 3099 | 'tipo' => 'vale.tipo', |
| 3100 | 'paid_when' => 'vale.paid_when', |
| 3101 | 'ultimo_pago' => 'vale.ultimo_pago', |
| 3102 | 'tipo_cambio' => 'vale.conversion_tipo_cambio', |
| 3103 | ), |
| 3104 | 'vale_log'=>array( |
| 3105 | 'tabla'=>'vale_log', |
| 3106 | 'from'=> "(vale_log LEFT JOIN cliente ON((vale_log.cliente_id = cliente.cliente_id)) left join categoria on((vale_log.categoria_id = categoria.categoria_id)))", |
| 3107 | 'where' => "", |
| 3108 | 'tienda_id'=>'vale_log.tienda_id', |
| 3109 | 'moneda_id'=>'vale_log.moneda_id', |
| 3110 | 'numero'=>'vale_log.vale_number', |
| 3111 | 'cliente_id' => 'vale_log.cliente_id', |
| 3112 | 'cliente' => 'if((vale_log.cliente_id is null), vale_log.cliente, cliente.nombre)', |
| 3113 | 'fecha' => 'vale_log.fecha', |
| 3114 | 'alta_db'=>'vale_log.alta_db', |
| 3115 | 'alta_por' => 'vale_log.alta_por', |
| 3116 | 'quantity' => 'vale_log.quantity', |
| 3117 | 'total_payments'=>'vale_log.total_payments', |
| 3118 | 'debe' => 'if(((vale_log.quantity - vale_log.total_payments) < 0),0,(vale_log.quantity - vale_log.total_payments))', |
| 3119 | 'saldo' => 'if((vale_log.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 3120 | 'cuentaT_deliveredto_id'=>'vale_log.dinero_en_cuentaT_id', |
| 3121 | 'origen_cuentat_id' => 'vale_log.dinero_en_cuentaT_id', |
| 3122 | 'numero_sistema' => 'vale_log.numero_sistema', |
| 3123 | 'remarks'=>'vale_log.remarks', |
| 3124 | 'autorizado' => 'vale_log.autorizado', |
| 3125 | 'autorizado_por' => 'vale_log.autorizado_por', |
| 3126 | 'autorizado_el' => 'vale_log.autorizado_el', |
| 3127 | 'borrado' => 'vale_log.borrado', |
| 3128 | 'borrado_por' => 'vale_log.borrado_por', |
| 3129 | 'borrado_el' => 'vale_log.borrado_el', |
| 3130 | 'doc_id' => 'vale_log.vale_id', |
| 3131 | 'doc_origen_id' => 'vale_log.vale_id', |
| 3132 | 'origen' => "'VALE'", |
| 3133 | 'paid' => 'vale_log.paid', |
| 3134 | 'delivered_directo' => '0', |
| 3135 | 'ultimo_movimiento' => 'vale_log.ultimo_movimiento', |
| 3136 | 'desautorizado_el' => 'vale_log.desautorizado_el', |
| 3137 | 'numero_contenedor' => 'vale_log.numero_contenedor', |
| 3138 | 'lugar_de_entrada' => 'vale_log.lugar_de_entrada', |
| 3139 | 'tipo_de_tela' => 'vale_log.tipo_de_tela', |
| 3140 | 'banco_cuenta_id' => 'vale_log.banco_cuenta_id', |
| 3141 | 'deposit_fecha' => 'vale_log.deposit_fecha', |
| 3142 | 'deposit_total' => 'vale_log.deposit_total', |
| 3143 | 'doc_moneda' => 'vale_log.moneda_id', |
| 3144 | 'remarks_wot' => 'vale_log.remarks_wot', |
| 3145 | 'cuentat_mov_id' => 'vale_log.cuenta_t_mov_id', |
| 3146 | 'acta_quantity' => '0', |
| 3147 | 'rechazado' => 'vale_log.rechazado', |
| 3148 | 'categoria_id' => 'vale_log.categoria_id', |
| 3149 | 'categoria' => 'categoria.categoria', |
| 3150 | 'tipo' => 'vale_log.tipo', |
| 3151 | 'paid_when' => 'vale_log.paid_when', |
| 3152 | 'ultimo_pago' => 'NULL', |
| 3153 | 'tipo_cambio' => 'vale_log.conversion_tipo_cambio', |
| 3154 | ), |
| 3155 | 'compra'=>array( |
| 3156 | 'tabla'=>'compra', |
| 3157 | 'from'=> "(compra left join cliente on((compra.cliente_id = cliente.cliente_id)) left join categoria on((compra.categoria_id = categoria.categoria_id)))", |
| 3158 | 'where' => "", |
| 3159 | 'tienda_id'=>'compra.tienda_id', |
| 3160 | 'moneda_id'=>'compra.moneda_id', |
| 3161 | 'numero'=>'compra.numero', |
| 3162 | 'cliente_id' => 'compra.cliente_id', |
| 3163 | 'cliente' => 'cliente.nombre', |
| 3164 | 'fecha' => 'if((compra.new_date is null),compra.original_date,compra.new_date)', |
| 3165 | 'alta_db'=>'compra.alta_db', |
| 3166 | 'alta_por' => 'compra.alta_por', |
| 3167 | 'quantity' => 'compra.quantity', |
| 3168 | 'total_payments'=>'compra.total_payments', |
| 3169 | 'debe' => 'if(((compra.quantity - compra.total_payments) < 0),0,(compra.quantity - compra.total_payments))', |
| 3170 | 'saldo' => 'if((compra.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 3171 | 'cuentaT_deliveredto_id'=>'compra.cuentaT_deliveredto_id', |
| 3172 | 'origen_cuentat_id' => 'compra.origen_cuentat_id', |
| 3173 | 'numero_sistema' => 'compra.numero_sistema', |
| 3174 | 'remarks'=>'compra.remarks', |
| 3175 | 'autorizado' => 'compra.autorizado', |
| 3176 | 'autorizado_por' => 'compra.autorizado_por', |
| 3177 | 'autorizado_el' => 'compra.autorizado_el', |
| 3178 | 'borrado' => 'compra.borrado', |
| 3179 | 'borrado_por' => 'compra.borrado_por', |
| 3180 | 'borrado_el' => 'compra.borrado_el', |
| 3181 | 'doc_id' => 'compra.compra_id', |
| 3182 | 'doc_origen_id' => 'compra.compra_id', |
| 3183 | 'origen' => "'COMPRA'", |
| 3184 | 'paid' => 'compra.paid', |
| 3185 | 'delivered_directo' => 'compra.delivered_directo', |
| 3186 | 'ultimo_movimiento' => 'compra.ultimo_movimiento', |
| 3187 | 'desautorizado_el' => 'compra.desautorizado_el', |
| 3188 | 'numero_contenedor' => 'compra.numero_contenedor', |
| 3189 | 'lugar_de_entrada' => 'compra.lugar_de_entrada', |
| 3190 | 'tipo_de_tela' => 'compra.tipo_de_tela', |
| 3191 | 'banco_cuenta_id' => '0', |
| 3192 | 'deposit_fecha' => 'NULL', |
| 3193 | 'deposit_total' => '0', |
| 3194 | 'doc_moneda' => 'compra.moneda_id', |
| 3195 | 'remarks_wot' => 'compra.remarks_wot', |
| 3196 | 'cuentat_mov_id' => 'compra.cuentat_mov_id', |
| 3197 | 'acta_quantity' => '0', |
| 3198 | 'rechazado' => 'compra.rechazado', |
| 3199 | 'categoria_id' => 'compra.categoria_id', |
| 3200 | 'categoria' => 'categoria.categoria', |
| 3201 | 'tipo' => 'compra.tipo', |
| 3202 | 'paid_when' => 'compra.paid_when', |
| 3203 | 'ultimo_pago' => 'compra.ultimo_pago', |
| 3204 | 'tipo_cambio' => '0.00', |
| 3205 | ), |
| 3206 | 'compra_log'=>array( |
| 3207 | 'tabla'=>'compra_log', |
| 3208 | 'from'=> "(compra_log LEFT JOIN cliente ON((compra_log.cliente_id = cliente.cliente_id)) left join categoria on((compra_log.categoria_id = categoria.categoria_id)))", |
| 3209 | 'where' => "", |
| 3210 | 'tienda_id'=>'compra_log.tienda_id', |
| 3211 | 'moneda_id'=>'compra_log.moneda_id', |
| 3212 | 'numero'=>'compra_log.numero', |
| 3213 | 'cliente_id' => 'compra_log.cliente_id', |
| 3214 | 'cliente' => 'cliente.nombre', |
| 3215 | 'fecha' => 'if((compra_log.new_date is null),compra_log.original_date,compra_log.new_date)', |
| 3216 | 'alta_db'=>'compra_log.alta_db', |
| 3217 | 'alta_por' => 'compra_log.alta_por', |
| 3218 | 'quantity' => 'compra_log.quantity', |
| 3219 | 'total_payments'=>'compra_log.total_payments', |
| 3220 | 'debe' => 'if(((compra_log.quantity - compra_log.total_payments) < 0),0,(compra_log.quantity - compra_log.total_payments))', |
| 3221 | 'saldo' => 'if((compra_log.moneda_id = 1),cliente.saldo_pesos,cliente.saldo_usd)', |
| 3222 | 'cuentaT_deliveredto_id'=>'compra_log.cuentaT_deliveredto_id', |
| 3223 | 'origen_cuentat_id' => 'compra_log.origen_cuentat_id', |
| 3224 | 'numero_sistema' => 'compra_log.numero_sistema', |
| 3225 | 'remarks'=>'compra_log.remarks', |
| 3226 | 'autorizado' => 'compra_log.autorizado', |
| 3227 | 'autorizado_por' => 'compra_log.autorizado_por', |
| 3228 | 'autorizado_el' => 'compra_log.autorizado_el', |
| 3229 | 'borrado' => 'compra_log.borrado', |
| 3230 | 'borrado_por' => 'compra_log.borrado_por', |
| 3231 | 'borrado_el' => 'compra_log.borrado_el', |
| 3232 | 'doc_id' => 'compra_log.compra_id', |
| 3233 | 'doc_origen_id' => 'compra_log.compra_id', |
| 3234 | 'origen' => "'COMPRA'", |
| 3235 | 'paid' => 'compra_log.paid', |
| 3236 | 'delivered_directo' => 'compra_log.delivered_directo', |
| 3237 | 'ultimo_movimiento' => 'compra_log.ultimo_movimiento', |
| 3238 | 'desautorizado_el' => 'compra_log.desautorizado_el', |
| 3239 | 'numero_contenedor' => 'compra_log.numero_contenedor', |
| 3240 | 'lugar_de_entrada' => 'compra_log.lugar_de_entrada', |
| 3241 | 'tipo_de_tela' => 'compra_log.tipo_de_tela', |
| 3242 | 'banco_cuenta_id' => '0', |
| 3243 | 'deposit_fecha' => 'NULL', |
| 3244 | 'deposit_total' => '0', |
| 3245 | 'doc_moneda' => 'compra_log.moneda_id', |
| 3246 | 'remarks_wot' => 'compra_log.remarks_wot', |
| 3247 | 'cuentat_mov_id' => 'compra_log.cuentat_mov_id', |
| 3248 | 'acta_quantity' => '0', |
| 3249 | 'rechazado' => 'compra_log.rechazado', |
| 3250 | 'categoria_id' => 'compra_log.categoria_id', |
| 3251 | 'categoria' => 'categoria.categoria', |
| 3252 | 'tipo' => 'compra_log.tipo', |
| 3253 | 'paid_when' => 'compra_log.paid_when', |
| 3254 | 'ultimo_pago' => 'NULL', |
| 3255 | 'tipo_cambio' => '0.00', |
| 3256 | ), |
| 3257 | 'cheque_pago_log'=>array( |
| 3258 | 'tabla'=>'cheque_pago_log', |
| 3259 | 'from'=> "((cheque_pago_log cp LEFT JOIN cheque ch ON((ch.cheque_id = cp.cheque_id))) LEFT JOIN cliente cli ON((ch.cliente_id = cli.cliente_id)))", |
| 3260 | 'where' => "", |
| 3261 | 'tienda_id'=>'ch.tienda_id', |
| 3262 | 'moneda_id'=>'cp.moneda_id', |
| 3263 | 'numero'=>'ch.numero', |
| 3264 | 'cliente_id' => 'ch.cliente_id', |
| 3265 | 'cliente' => 'cli.nombre', |
| 3266 | 'fecha' => 'cp.fecha', |
| 3267 | 'alta_db'=>'cp.alta_db', |
| 3268 | 'alta_por' => 'cp.alta_por', |
| 3269 | 'quantity' => 'ch.quantity', |
| 3270 | 'total_payments'=>'ch.total_payments', |
| 3271 | 'debe' => 'if(((ch.quantity - ch.total_payments) < 0),0,(ch.quantity - ch.total_payments))', |
| 3272 | 'saldo' => 'if((ch.moneda_id = 1),cli.saldo_pesos,cli.saldo_usd)', |
| 3273 | 'cuentaT_deliveredto_id'=>'NULL', |
| 3274 | 'origen_cuentat_id' => 'cp.cuentaT_id', |
| 3275 | 'numero_sistema' => 'cp.numero_referencia', |
| 3276 | 'remarks'=>'cp.comentario', |
| 3277 | 'autorizado' => 'cp.autorizado', |
| 3278 | 'autorizado_por' => 'cp.autorizado_por', |
| 3279 | 'autorizado_el' => 'cp.autorizado_el', |
| 3280 | 'borrado' => "'Si'", |
| 3281 | 'borrado_por' => 'cp.alta_por', |
| 3282 | 'borrado_el' => 'cp.fecha_borrado', |
| 3283 | 'doc_id' => 'cp.cheque_pago_log_id', |
| 3284 | 'doc_origen_id' => 'ch.cheque_id', |
| 3285 | 'origen' => "if((cp.banco_cuenta_id > 0),'CHEQUE LINK',if((cp.metodo_pago_id = 14), 'CHEQUE VALE', 'CHEQUE CASH'))", |
| 3286 | 'paid' => 'ch.paid', |
| 3287 | 'delivered_directo' => 'ch.delivered_directo', |
| 3288 | 'ultimo_movimiento' => "if((cp.banco_cuenta_id > 0),'LINK BORRADO','A CUENTA BORRADO')", |
| 3289 | 'desautorizado_el' => 'cp.desautorizado_el', |
| 3290 | 'numero_contenedor' => "''", |
| 3291 | 'lugar_de_entrada' => "''", |
| 3292 | 'tipo_de_tela' => "''", |
| 3293 | 'banco_cuenta_id' => 'cp.banco_cuenta_id', |
| 3294 | 'deposit_fecha' => 'cp.deposit_fecha', |
| 3295 | 'deposit_total' => 'cp.deposit_total', |
| 3296 | 'doc_moneda' => 'ch.moneda_id', |
| 3297 | 'remarks_wot' => 'ch.remarks_wot', |
| 3298 | 'cuentat_mov_id' => 'cp.cuenta_t_mov_id', |
| 3299 | 'acta_quantity' => 'cp.quantity_total', |
| 3300 | 'rechazado' => 'cp.rechazado', |
| 3301 | 'categoria_id' => '0', |
| 3302 | 'categoria' => "'CATEGORIA'", |
| 3303 | 'tipo' => "ch.tipo", |
| 3304 | 'paid_when' => 'NULL', |
| 3305 | 'ultimo_pago' => 'NULL', |
| 3306 | 'tipo_cambio' => '0.00', |
| 3307 | ), |
| 3308 | 'pagare_pago_log'=>array( |
| 3309 | 'tabla'=>'pagare_pago_log', |
| 3310 | 'from'=> "((pagare_pago_log cp LEFT JOIN pagare ch ON((ch.pagare_id = cp.pagare_id))) LEFT JOIN cliente cli ON((ch.cliente_id = cli.cliente_id)))", |
| 3311 | 'where' => "", |
| 3312 | 'tienda_id'=>'ch.tienda_id', |
| 3313 | 'moneda_id'=>'cp.moneda_id', |
| 3314 | 'numero'=>'ch.numero', |
| 3315 | 'cliente_id' => 'ch.cliente_id', |
| 3316 | 'cliente' => 'cli.nombre', |
| 3317 | 'fecha' => 'cp.fecha', |
| 3318 | 'alta_db'=>'cp.alta_db', |
| 3319 | 'alta_por' => 'cp.alta_por', |
| 3320 | 'quantity' => 'ch.quantity', |
| 3321 | 'total_payments'=>'ch.total_payments', |
| 3322 | 'debe' => 'if(((ch.quantity - ch.total_payments) < 0),0,(ch.quantity - ch.total_payments))', |
| 3323 | 'saldo' => 'if((ch.moneda_id = 1),cli.saldo_pesos,cli.saldo_usd)', |
| 3324 | 'cuentaT_deliveredto_id'=>'NULL', |
| 3325 | 'origen_cuentat_id' => 'cp.cuentaT_id', |
| 3326 | 'numero_sistema' => 'cp.numero_referencia', |
| 3327 | 'remarks'=>'cp.comentario', |
| 3328 | 'autorizado' => 'cp.autorizado', |
| 3329 | 'autorizado_por' => 'cp.autorizado_por', |
| 3330 | 'autorizado_el' => 'cp.autorizado_el', |
| 3331 | 'borrado' => "'Si'", |
| 3332 | 'borrado_por' => 'cp.alta_por', |
| 3333 | 'borrado_el' => 'cp.fecha_borrado', |
| 3334 | 'doc_id' => 'cp.pagare_pago_log_id', |
| 3335 | 'doc_origen_id' => 'ch.pagare_id', |
| 3336 | 'origen' => "if((cp.banco_cuenta_id > 0),'PAGARE LINK',if((cp.metodo_pago_id = 14), 'PAGARE VALE', 'PAGARE CASH'))", |
| 3337 | 'paid' => 'ch.paid', |
| 3338 | 'delivered_directo' => 'ch.delivered_directo', |
| 3339 | 'ultimo_movimiento' => "if((cp.banco_cuenta_id > 0),'LINK BORRADO','A CUENTA BORRADO')", |
| 3340 | 'desautorizado_el' => 'cp.desautorizado_el', |
| 3341 | 'numero_contenedor' => "''", |
| 3342 | 'lugar_de_entrada' => "''", |
| 3343 | 'tipo_de_tela' => "''", |
| 3344 | 'banco_cuenta_id' => 'cp.banco_cuenta_id', |
| 3345 | 'deposit_fecha' => 'cp.deposit_fecha', |
| 3346 | 'deposit_total' => 'cp.deposit_total', |
| 3347 | 'doc_moneda' => 'ch.moneda_id', |
| 3348 | 'remarks_wot' => 'ch.remarks_wot', |
| 3349 | 'cuentat_mov_id' => 'cp.cuenta_t_mov_id', |
| 3350 | 'acta_quantity' => 'cp.quantity_total', |
| 3351 | 'rechazado' => 'cp.rechazado', |
| 3352 | 'categoria_id' => '0', |
| 3353 | 'categoria' => "'CATEGORIA'", |
| 3354 | 'tipo' => "''", |
| 3355 | 'paid_when' => 'NULL', |
| 3356 | 'ultimo_pago' => 'NULL', |
| 3357 | 'tipo_cambio' => '0.00', |
| 3358 | ), |
| 3359 | 'vale_pago_log'=>array( |
| 3360 | 'tabla'=>'vale_pago_log', |
| 3361 | 'from'=> "((vale_pago_log cp LEFT JOIN vale ch ON((ch.vale_id = cp.vale_id))) LEFT JOIN cliente cli ON((ch.cliente_id = cli.cliente_id)))", |
| 3362 | 'where' => "", |
| 3363 | 'tienda_id'=>'ch.tienda_id', |
| 3364 | 'moneda_id'=>'cp.moneda_id', |
| 3365 | 'numero'=>'ch.vale_number', |
| 3366 | 'cliente_id' => 'ch.cliente_id', |
| 3367 | 'cliente' => 'cli.nombre', |
| 3368 | 'fecha' => 'cp.fecha', |
| 3369 | 'alta_db'=>'cp.alta_db', |
| 3370 | 'alta_por' => 'cp.alta_por', |
| 3371 | 'quantity' => 'ch.quantity', |
| 3372 | 'total_payments'=>'ch.total_payments', |
| 3373 | 'debe' => 'if(((ch.quantity - ch.total_payments) < 0),0,(ch.quantity - ch.total_payments))', |
| 3374 | 'saldo' => 'if((ch.moneda_id = 1),cli.saldo_pesos,cli.saldo_usd)', |
| 3375 | 'cuentaT_deliveredto_id'=>'NULL', |
| 3376 | 'origen_cuentat_id' => 'cp.cuentaT_id', |
| 3377 | 'numero_sistema' => 'cp.numero_referencia', |
| 3378 | 'remarks'=>'cp.comentario', |
| 3379 | 'autorizado' => 'cp.autorizado', |
| 3380 | 'autorizado_por' => 'cp.autorizado_por', |
| 3381 | 'autorizado_el' => 'cp.autorizado_el', |
| 3382 | 'borrado' => "'Si'", |
| 3383 | 'borrado_por' => 'cp.alta_por', |
| 3384 | 'borrado_el' => 'cp.fecha_borrado', |
| 3385 | 'doc_id' => 'cp.vale_pago_log_id', |
| 3386 | 'doc_origen_id' => 'ch.vale_id', |
| 3387 | 'origen' => "if(cp.banco_cuenta_id > 0,'VALE PAGO LINK', 'VALE PAGO CASH')", |
| 3388 | 'paid' => 'ch.paid', |
| 3389 | 'delivered_directo' => 'ch.delivered_directo', |
| 3390 | 'ultimo_movimiento' => "if((cp.banco_cuenta_id > 0),'LINK BORRADO','A CUENTA BORRADO')", |
| 3391 | 'desautorizado_el' => 'NULL', |
| 3392 | 'numero_contenedor' => "''", |
| 3393 | 'lugar_de_entrada' => "''", |
| 3394 | 'tipo_de_tela' => "''", |
| 3395 | 'banco_cuenta_id' => 'cp.banco_cuenta_id', |
| 3396 | 'deposit_fecha' => 'cp.deposit_fecha', |
| 3397 | 'deposit_total' => 'cp.deposit_total', |
| 3398 | 'doc_moneda' => 'ch.moneda_id', |
| 3399 | 'remarks_wot' => 'ch.remarks_wot', |
| 3400 | 'cuentat_mov_id' => 'cp.cuenta_t_mov_id', |
| 3401 | 'acta_quantity' => 'cp.quantity_total', |
| 3402 | 'rechazado' => 'cp.rechazado', |
| 3403 | 'categoria_id' => '0', |
| 3404 | 'categoria' => "'CATEGORIA'", |
| 3405 | 'tipo' => "''", |
| 3406 | 'paid_when' => 'NULL', |
| 3407 | 'ultimo_pago' => 'NULL', |
| 3408 | 'tipo_cambio' => '0.00', |
| 3409 | ), |
| 3410 | 'compra_pago_log'=>array( |
| 3411 | 'tabla'=>'compra_pago_log', |
| 3412 | 'from'=> "((compra_pago_log cp LEFT JOIN compra ch ON((ch.compra_id = cp.compra_id))) LEFT JOIN cliente cli ON((ch.cliente_id = cli.cliente_id)))", |
| 3413 | 'where' => "", |
| 3414 | 'tienda_id'=>'ch.tienda_id', |
| 3415 | 'moneda_id'=>'cp.moneda_id', |
| 3416 | 'numero'=>'ch.numero', |
| 3417 | 'cliente_id' => 'ch.cliente_id', |
| 3418 | 'cliente' => 'cli.nombre', |
| 3419 | 'fecha' => 'cp.fecha', |
| 3420 | 'alta_db'=>'cp.alta_db', |
| 3421 | 'alta_por' => 'cp.alta_por', |
| 3422 | 'quantity' => 'ch.quantity', |
| 3423 | 'total_payments'=>'ch.total_payments', |
| 3424 | 'debe' => 'if(((ch.quantity - ch.total_payments) < 0),0,(ch.quantity - ch.total_payments))', |
| 3425 | 'saldo' => 'if((ch.moneda_id = 1),cli.saldo_pesos,cli.saldo_usd)', |
| 3426 | 'cuentaT_deliveredto_id'=>'NULL', |
| 3427 | 'origen_cuentat_id' => 'cp.cuentaT_id', |
| 3428 | 'numero_sistema' => 'cp.numero_referencia', |
| 3429 | 'remarks'=>'cp.comentario', |
| 3430 | 'autorizado' => 'cp.autorizado', |
| 3431 | 'autorizado_por' => 'cp.autorizado_por', |
| 3432 | 'autorizado_el' => 'cp.autorizado_el', |
| 3433 | 'borrado' => "'Si'", |
| 3434 | 'borrado_por' => 'cp.alta_por', |
| 3435 | 'borrado_el' => 'cp.fecha_borrado', |
| 3436 | 'doc_id' => 'cp.compra_pago_log_id', |
| 3437 | 'doc_origen_id' => 'ch.compra_id', |
| 3438 | 'origen' => "'COMPRA CASH'", |
| 3439 | 'paid' => 'ch.paid', |
| 3440 | 'delivered_directo' => 'ch.delivered_directo', |
| 3441 | 'ultimo_movimiento' => "if((cp.banco_cuenta_id > 0),'LINK BORRADO','A CUENTA BORRADO')", |
| 3442 | 'desautorizado_el' => 'cp.desautorizado_el', |
| 3443 | 'numero_contenedor' => "''", |
| 3444 | 'lugar_de_entrada' => "''", |
| 3445 | 'tipo_de_tela' => "''", |
| 3446 | 'banco_cuenta_id' => 'cp.banco_cuenta_id', |
| 3447 | 'deposit_fecha' => 'cp.deposit_fecha', |
| 3448 | 'deposit_total' => 'cp.deposit_total', |
| 3449 | 'doc_moneda' => 'ch.moneda_id', |
| 3450 | 'remarks_wot' => 'ch.remarks_wot', |
| 3451 | 'cuentat_mov_id' => 'cp.cuenta_t_mov_id', |
| 3452 | 'acta_quantity' => 'cp.quantity_total', |
| 3453 | 'rechazado' => 'cp.rechazado', |
| 3454 | 'categoria_id' => '0', |
| 3455 | 'categoria' => "'CATEGORIA'", |
| 3456 | 'tipo' => "ch.tipo", |
| 3457 | 'paid_when' => 'NULL', |
| 3458 | 'ultimo_pago' => 'NULL', |
| 3459 | 'tipo_cambio' => '0.00', |
| 3460 | ), |
| 3461 | 'cuentat_a_banco'=>array( |
| 3462 | 'tabla'=>'cuentat_a_banco', |
| 3463 | 'from'=> " cuentat_a_banco ", |
| 3464 | 'where' => " ((cuentat_a_banco.activo = 'No') and (cuentat_a_banco.factura_directa = 'NO'))", |
| 3465 | 'tienda_id'=>'cuentat_a_banco.tienda_id', |
| 3466 | 'moneda_id'=>'cuentat_a_banco.moneda_id', |
| 3467 | 'numero'=>'cuentat_a_banco.numero_referencia', |
| 3468 | 'cliente_id' => "''", |
| 3469 | 'cliente' => 'cuentat_a_banco.cliente', |
| 3470 | 'fecha' => 'cuentat_a_banco.fecha', |
| 3471 | 'alta_db'=>'cuentat_a_banco.ultimo_cambio', |
| 3472 | 'alta_por' => 'cuentat_a_banco.ultimo_cambio_por', |
| 3473 | 'quantity' => 'cuentat_a_banco.egreso', |
| 3474 | 'total_payments'=> '0', |
| 3475 | 'debe' => '0', |
| 3476 | 'saldo' => '0', |
| 3477 | 'cuentaT_deliveredto_id'=> 'NULL', |
| 3478 | 'origen_cuentat_id' => "if((cuentat_a_banco.afecta_cuentat = 'NO'),NULL,cuentat_a_banco.cuentaT_id)", |
| 3479 | 'numero_sistema' => 'cuentat_a_banco.numero_referencia', |
| 3480 | 'remarks'=>'cuentat_a_banco.remarks', |
| 3481 | 'autorizado' => 'cuentat_a_banco.autorizado', |
| 3482 | 'autorizado_por' => 'cuentat_a_banco.autorizado_por', |
| 3483 | 'autorizado_el' => 'cuentat_a_banco.autorizado_el', |
| 3484 | 'borrado' => "'Si'", |
| 3485 | 'borrado_por' => 'cuentat_a_banco.alta_por', |
| 3486 | 'borrado_el' => 'cuentat_a_banco.alta_db', |
| 3487 | 'doc_id' => 'cuentat_a_banco.cuentat_a_banco_mov_id', |
| 3488 | 'doc_origen_id' => 'cuentat_a_banco.cuentat_a_banco_mov_id', |
| 3489 | 'origen' => "'CUENTA T'", |
| 3490 | 'paid' => '0', |
| 3491 | 'delivered_directo' => '0', |
| 3492 | 'ultimo_movimiento' => "IF(cuentat_a_banco.deposit_total > cuentat_a_banco.egreso AND cuentat_a_banco.ide_amount = 0 AND cuentat_a_banco.ide_percent = 0 AND cuentat_a_banco.tarjeta_amount = 0 AND cuentat_a_banco.tarjeta_percent = 0, 'LINK PARCIAL BORRADO', 'LINK BORRADO')", |
| 3493 | 'desautorizado_el' => 'cuentat_a_banco.desautorizado_el', |
| 3494 | 'numero_contenedor' => "''", |
| 3495 | 'lugar_de_entrada' => "''", |
| 3496 | 'tipo_de_tela' => "''", |
| 3497 | 'banco_cuenta_id' => 'cuentat_a_banco.banco_cuenta_id', |
| 3498 | 'deposit_fecha' => 'cuentat_a_banco.deposit_fecha', |
| 3499 | 'deposit_total' => 'cuentat_a_banco.deposit_total', |
| 3500 | 'doc_moneda' => 'cuentat_a_banco.moneda_id', |
| 3501 | 'remarks_wot' => 'cuentat_a_banco.remarks', |
| 3502 | 'cuentat_mov_id' => 'cuentat_a_banco.cuentaT_mov_id', |
| 3503 | 'acta_quantity' => '0', |
| 3504 | 'rechazado' => 'cuentat_a_banco.rechazado', |
| 3505 | 'categoria_id' => '0', |
| 3506 | 'categoria' => "'CATEGORIA'", |
| 3507 | 'tipo' => "''", |
| 3508 | 'paid_when' => 'NULL', |
| 3509 | 'ultimo_pago' => 'NULL', |
| 3510 | 'tipo_cambio' => '0.00', |
| 3511 | ), |
| 3512 | ); |
| 3513 | } |
| 3514 | |
| 3515 | function obten_sql_norm_doctos($origen='', $id=''){ |
| 3516 | if(empty($origen)) |
| 3517 | return ""; |
| 3518 | |
| 3519 | $normalize = obten_array_norm_doctos(); |
| 3520 | |
| 3521 | $sql1="SELECT "; |
| 3522 | |
| 3523 | foreach($normalize[$origen] as $col => $value) { |
| 3524 | if($col=='tabla' || $col=='from' || $col=='where') continue; |
| 3525 | |
| 3526 | $sql1 .= $value . " AS $col, "; |
| 3527 | } |
| 3528 | |
| 3529 | $sql1 = substr($sql1, 0,-2); |
| 3530 | |
| 3531 | if(!is_array($id)) |
| 3532 | $id_in = "=".strit($id); |
| 3533 | else { |
| 3534 | $id_in = " IN ('" . implode("','", $id) . "') "; |
| 3535 | } |
| 3536 | |
| 3537 | return $sql1 .= " FROM ".$normalize[$origen]['from']." WHERE ".$normalize[$origen]['doc_id'] . $id_in . (empty($normalize[$origen]['where']) ? "" : " AND " . $normalize[$origen]['where']); |
| 3538 | |
| 3539 | } |
| 3540 | |
| 3541 | function delete_from_links_al_banco_live($id=''){ |
| 3542 | if(empty($id)) |
| 3543 | return ; |
| 3544 | |
| 3545 | $sql_delete = "DELETE FROM links_al_banco_live WHERE link_id = ".strit($id); |
| 3546 | |
| 3547 | return $sql_delete; |
| 3548 | } |
| 3549 | |
| 3550 | /** |
| 3551 | * @param string $cuentat_a_banco_mov_id |
| 3552 | * @param string $cheque_pago_id |
| 3553 | * @param string $pagare_pago_id |
| 3554 | * @param string $vale_pago_id |
| 3555 | * @param string $vale_id |
| 3556 | * @param string $cuentat_a_banco_tc_mov_id |
| 3557 | * @param string $banco_cuenta_trans_id |
| 3558 | * @param string $cheque_pago_log_id |
| 3559 | * @param string $pagare_pago_log_id |
| 3560 | * @param string $vale_pago_log_id |
| 3561 | * @param string $inversion_reembolso |
| 3562 | * @param string $origen |
| 3563 | * @return string $sql con un insert a links_al_banco_live |
| 3564 | */ |
| 3565 | function insert_update_links_al_banco_live($cuentat_a_banco_mov_id='', $cheque_pago_id= '', $pagare_pago_id = '', $vale_pago_id = '', $vale_id = '', $cuentat_a_banco_tc_mov_id = '', $banco_cuenta_trans_id = '', $cheque_pago_log_id = '', $pagare_pago_log_id = '', $vale_pago_log_id = '', $inversion_reembolso_id = '', $vale_log_id = '', $origen=''){ |
| 3566 | |
| 3567 | $sql_doc = "(SELECT |
| 3568 | a.cuentat_a_banco_mov_id AS link_id, |
| 3569 | a.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 3570 | a.origen AS origen, |
| 3571 | a.cuentat_a_banco_mov_id AS doc_id, |
| 3572 | a.cuentaT_id AS cuentaT_id, |
| 3573 | a.tienda_id AS tienda_id, |
| 3574 | a.fecha AS fecha, |
| 3575 | a.banco_cuenta_id AS banco_cuenta_id, |
| 3576 | a.cuentaT_tipo_mov_id AS cuentaT_tipo_mov_id, |
| 3577 | a.deposit_total AS deposit_total, |
| 3578 | a.quantity_total AS quantity_total, |
| 3579 | a.ide_amount AS ide_amount, |
| 3580 | a.ide_percent AS ide_percent, |
| 3581 | a.egreso AS egreso, |
| 3582 | a.monto AS monto, |
| 3583 | a.tipo_cash_nota AS tipo_cash_nota, |
| 3584 | a.cash_nota_num AS cash_nota_num, |
| 3585 | a.deposit_fecha AS deposit_fecha, |
| 3586 | a.cliente AS cliente, |
| 3587 | a.factura AS factura, |
| 3588 | a.factura_numero AS factura_numero, |
| 3589 | a.iva_incluido AS iva_incluido, |
| 3590 | a.ivacobradox100 AS ivacobradox100, |
| 3591 | IF((a.iva_incluido = 'SI'),0.00,a.ivacobradototal) AS ivarealmentecobrado, |
| 3592 | IF((a.iva_incluido = 'NO'),0.00,a.ivacobradototal) AS ivacobradototal, |
| 3593 | a.alta_db AS alta_db, |
| 3594 | a.alta_por AS alta_por, |
| 3595 | a.numero_referencia AS numero_referencia, |
| 3596 | a.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 3597 | a.empresa_id AS empresa_id, |
| 3598 | a.remarks AS remarks, |
| 3599 | a.puede_borrar AS puede_borrar, |
| 3600 | a.activo AS activo, |
| 3601 | a.afecta_cuentat AS afecta_cuentat, |
| 3602 | a.comments AS comments, |
| 3603 | a.autorizado AS autorizado, |
| 3604 | a.rechazado AS rechazado, |
| 3605 | a.revisado AS revisado, |
| 3606 | a.autorizado_el AS autorizado_el, |
| 3607 | a.autorizado_por AS autorizado_por, |
| 3608 | a.MetodoPago AS MetodoPago, |
| 3609 | a.FormaPago AS FormaPago, |
| 3610 | a.UsoCFDI AS UsoCFDI, |
| 3611 | a.iva_revisado AS iva_revisado, |
| 3612 | a.iva_revisado_por AS iva_revisado_por, |
| 3613 | a.iva_revisado_el AS iva_revisado_el, |
| 3614 | a.ultimo_cambio AS ultimo_cambio, |
| 3615 | a.ultimo_cambio_por AS ultimo_cambio_por, |
| 3616 | a.cliente_rfc AS cliente_rfc, |
| 3617 | a.referencia AS referencia, |
| 3618 | a.origen_mov_id AS origen_mov_id, |
| 3619 | a.factura_directa AS factura_directa, |
| 3620 | a.moneda_id AS moneda_id, |
| 3621 | a.fecha_capturado AS fecha_capturado, |
| 3622 | a.json_file_attachments AS json_file_attachments, |
| 3623 | a.cancelacion_revisada AS cancelacion_revisada, |
| 3624 | a.cancelacion_revisada_por AS cancelacion_revisada_por, |
| 3625 | a.cancelacion_revisada_el AS cancelacion_revisada_el, |
| 3626 | a.cancelacion_el AS cancelacion_el |
| 3627 | FROM cuentat_a_banco a |
| 3628 | WHERE a.cuentat_a_banco_mov_id <> '' AND a.cuentat_a_banco_mov_id = '$cuentat_a_banco_mov_id') |
| 3629 | UNION ALL |
| 3630 | (SELECT |
| 3631 | b.cheque_pago_id AS link_id, |
| 3632 | b.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 3633 | b.origen AS origen, |
| 3634 | b.cheque_id AS doc_id, |
| 3635 | b.cuentaT_id AS cuentaT_id, |
| 3636 | b.tienda_id AS tienda_id, |
| 3637 | b.fecha AS fecha, |
| 3638 | b.banco_cuenta_id AS banco_cuenta_id, |
| 3639 | b.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 3640 | b.deposit_total AS deposit_total, |
| 3641 | b.quantity_total AS quantity_total, |
| 3642 | b.ide_amount AS ide_amount, |
| 3643 | b.ide_percent AS ide_percent, |
| 3644 | b.quantity_ctat AS egreso, |
| 3645 | 0.00 AS monto, |
| 3646 | b.tipo_cash_nota AS tipo_cash_nota, |
| 3647 | b.cash_nota_num AS cash_nota_num, |
| 3648 | b.deposit_fecha AS deposit_fecha, |
| 3649 | b.cliente AS cliente, |
| 3650 | b.factura AS factura, |
| 3651 | b.factura_numero AS factura_numero, |
| 3652 | b.iva_incluido AS iva_incluido, |
| 3653 | b.ivacobradox100 AS ivacobradox100, |
| 3654 | IF((b.iva_incluido = 'SI'),0.00,b.ivacobradototal) AS ivarealmentecobrado, |
| 3655 | IF((b.iva_incluido = 'NO'),0.00,b.ivacobradototal) AS ivacobradototal, |
| 3656 | b.alta_db AS alta_db, |
| 3657 | b.alta_por AS alta_por, |
| 3658 | b.numero_referencia AS numero_referencia, |
| 3659 | b.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 3660 | b.empresa_id AS empresa_id, |
| 3661 | b.comentario AS remarks, |
| 3662 | b.puede_borrar AS puede_borrar, |
| 3663 | b.activo AS activo, |
| 3664 | b.afecta_cuentat AS afecta_cuentat, |
| 3665 | b.comments AS comments, |
| 3666 | b.autorizado AS autorizado, |
| 3667 | b.rechazado AS rechazado, |
| 3668 | b.revisado AS revisado, |
| 3669 | b.autorizado_el AS autorizado_el, |
| 3670 | b.autorizado_por AS autorizado_por, |
| 3671 | b.MetodoPago AS MetodoPago, |
| 3672 | b.FormaPago AS FormaPago, |
| 3673 | b.UsoCFDI AS UsoCFDI, |
| 3674 | b.iva_revisado AS iva_revisado, |
| 3675 | b.iva_revisado_por AS iva_revisado_por, |
| 3676 | b.iva_revisado_el AS iva_revisado_el, |
| 3677 | b.ultimo_cambio AS ultimo_cambio, |
| 3678 | b.ultimo_cambio_por AS ultimo_cambio_por, |
| 3679 | b.cliente_rfc AS cliente_rfc, |
| 3680 | b.referencia AS referencia, |
| 3681 | b.cuenta_t_mov_id AS origen_mov_id, |
| 3682 | 'NO' AS factura_directa, |
| 3683 | b.moneda_id AS moneda_id, |
| 3684 | b.fecha_capturado AS fecha_capturado, |
| 3685 | b.json_file_attachments AS json_file_attachments, |
| 3686 | b.cancelacion_revisada AS cancelacion_revisada, |
| 3687 | b.cancelacion_revisada_por AS cancelacion_revisada_por, |
| 3688 | b.cancelacion_revisada_el AS cancelacion_revisada_el, |
| 3689 | b.cancelacion_el AS cancelacion_el |
| 3690 | FROM cheque_pago b |
| 3691 | WHERE b.banco_cuenta_id > 0 AND b.banco_cuenta_mov_link_id <> '' AND b.cheque_pago_id <> '' AND b.cheque_pago_id = '$cheque_pago_id') |
| 3692 | UNION ALL |
| 3693 | (SELECT |
| 3694 | c.pagare_pago_id AS link_id, |
| 3695 | c.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 3696 | c.origen AS origen, |
| 3697 | c.pagare_id AS doc_id, |
| 3698 | c.cuentaT_id AS cuentaT_id, |
| 3699 | c.tienda_id AS tienda_id, |
| 3700 | c.fecha AS fecha, |
| 3701 | c.banco_cuenta_id AS banco_cuenta_id, |
| 3702 | c.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 3703 | c.deposit_total AS deposit_total, |
| 3704 | c.quantity_total AS quantity_total, |
| 3705 | c.ide_amount AS ide_amount, |
| 3706 | c.ide_percent AS ide_percent, |
| 3707 | c.quantity_ctat AS egreso, |
| 3708 | 0.00 AS monto, |
| 3709 | c.tipo_cash_nota AS tipo_cash_nota, |
| 3710 | c.cash_nota_num AS cash_nota_num, |
| 3711 | c.deposit_fecha AS deposit_fecha, |
| 3712 | c.cliente AS cliente, |
| 3713 | c.factura AS factura, |
| 3714 | c.factura_numero AS factura_numero, |
| 3715 | c.iva_incluido AS iva_incluido, |
| 3716 | c.ivacobradox100 AS ivacobradox100, |
| 3717 | IF((c.iva_incluido = 'SI'),0.00,c.ivacobradototal) AS ivarealmentecobrado, |
| 3718 | IF((c.iva_incluido = 'NO'),0.00,c.ivacobradototal) AS ivacobradototal, |
| 3719 | c.alta_db AS alta_db, |
| 3720 | c.alta_por AS alta_por, |
| 3721 | c.numero_referencia AS numero_referencia, |
| 3722 | c.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 3723 | c.empresa_id AS empresa_id, |
| 3724 | c.comentario AS remarks, |
| 3725 | c.puede_borrar AS puede_borrar, |
| 3726 | c.activo AS activo, |
| 3727 | c.afecta_cuentat AS afecta_cuentat, |
| 3728 | c.comments AS comments, |
| 3729 | c.autorizado AS autorizado, |
| 3730 | c.rechazado AS rechazado, |
| 3731 | c.revisado AS revisado, |
| 3732 | c.autorizado_el AS autorizado_el, |
| 3733 | c.autorizado_por AS autorizado_por, |
| 3734 | c.MetodoPago AS MetodoPago, |
| 3735 | c.FormaPago AS FormaPago, |
| 3736 | c.UsoCFDI AS UsoCFDI, |
| 3737 | c.iva_revisado AS iva_revisado, |
| 3738 | c.iva_revisado_por AS iva_revisado_por, |
| 3739 | c.iva_revisado_el AS iva_revisado_el, |
| 3740 | c.ultimo_cambio AS ultimo_cambio, |
| 3741 | c.ultimo_cambio_por AS ultimo_cambio_por, |
| 3742 | c.cliente_rfc AS cliente_rfc, |
| 3743 | c.referencia AS referencia, |
| 3744 | c.cuenta_t_mov_id AS origen_mov_id, |
| 3745 | 'NO' AS factura_directa, |
| 3746 | c.moneda_id AS moneda_id, |
| 3747 | c.fecha_capturado AS fecha_capturado, |
| 3748 | c.json_file_attachments AS json_file_attachments, |
| 3749 | c.cancelacion_revisada AS cancelacion_revisada, |
| 3750 | c.cancelacion_revisada_por AS cancelacion_revisada_por, |
| 3751 | c.cancelacion_revisada_el AS cancelacion_revisada_el, |
| 3752 | c.cancelacion_el AS cancelacion_el |
| 3753 | FROM pagare_pago c |
| 3754 | WHERE c.banco_cuenta_id > 0 AND c.banco_cuenta_mov_link_id <> '' AND c.pagare_pago_id <> '' AND c.pagare_pago_id = '$pagare_pago_id') |
| 3755 | UNION ALL |
| 3756 | (SELECT |
| 3757 | j.vale_pago_id AS link_id, |
| 3758 | j.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 3759 | j.origen AS origen, |
| 3760 | j.vale_id AS doc_id, |
| 3761 | j.cuentaT_id AS cuentaT_id, |
| 3762 | j.tienda_id AS tienda_id, |
| 3763 | j.fecha AS fecha, |
| 3764 | j.banco_cuenta_id AS banco_cuenta_id, |
| 3765 | j.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 3766 | j.deposit_total AS deposit_total, |
| 3767 | j.quantity_total AS quantity_total, |
| 3768 | j.ide_amount AS ide_amount, |
| 3769 | j.ide_percent AS ide_percent, |
| 3770 | j.quantity_ctat AS egreso, |
| 3771 | 0.00 AS monto, |
| 3772 | j.tipo_cash_nota AS tipo_cash_nota, |
| 3773 | j.cash_nota_num AS cash_nota_num, |
| 3774 | j.deposit_fecha AS deposit_fecha, |
| 3775 | j.cliente AS cliente, |
| 3776 | j.factura AS factura, |
| 3777 | j.factura_numero AS factura_numero, |
| 3778 | j.iva_incluido AS iva_incluido, |
| 3779 | j.ivacobradox100 AS ivacobradox100, |
| 3780 | IF((j.iva_incluido = 'SI'),0.00,j.ivacobradototal) AS ivarealmentecobrado, |
| 3781 | IF((j.iva_incluido = 'NO'),0.00,j.ivacobradototal) AS ivacobradototal, |
| 3782 | j.alta_db AS alta_db, |
| 3783 | j.alta_por AS alta_por, |
| 3784 | j.numero_referencia AS numero_referencia, |
| 3785 | j.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 3786 | j.empresa_id AS empresa_id, |
| 3787 | j.comentario AS remarks, |
| 3788 | j.puede_borrar AS puede_borrar, |
| 3789 | j.activo AS activo, |
| 3790 | j.afecta_cuentat AS afecta_cuentat, |
| 3791 | j.comments AS comments, |
| 3792 | j.autorizado AS autorizado, |
| 3793 | j.rechazado AS rechazado, |
| 3794 | j.revisado AS revisado, |
| 3795 | j.autorizado_el AS autorizado_el, |
| 3796 | j.autorizado_por AS autorizado_por, |
| 3797 | j.MetodoPago AS MetodoPago, |
| 3798 | j.FormaPago AS FormaPago, |
| 3799 | j.UsoCFDI AS UsoCFDI, |
| 3800 | j.iva_revisado AS iva_revisado, |
| 3801 | j.iva_revisado_por AS iva_revisado_por, |
| 3802 | j.iva_revisado_el AS iva_revisado_el, |
| 3803 | j.ultimo_cambio AS ultimo_cambio, |
| 3804 | j.ultimo_cambio_por AS ultimo_cambio_por, |
| 3805 | j.cliente_rfc AS cliente_rfc, |
| 3806 | j.referencia AS referencia, |
| 3807 | j.cuenta_t_mov_id AS origen_mov_id, |
| 3808 | 'NO' AS factura_directa, |
| 3809 | j.moneda_id AS moneda_id, |
| 3810 | j.fecha_capturado AS fecha_capturado, |
| 3811 | '' AS json_file_attachments, |
| 3812 | j.cancelacion_revisada AS cancelacion_revisada, |
| 3813 | j.cancelacion_revisada_por AS cancelacion_revisada_por, |
| 3814 | j.cancelacion_revisada_el AS cancelacion_revisada_el, |
| 3815 | j.cancelacion_el AS cancelacion_el |
| 3816 | FROM vale_pago j |
| 3817 | WHERE j.banco_cuenta_id > 0 AND j.banco_cuenta_mov_link_id <> '' AND j.vale_pago_id <> '' AND j.vale_pago_id = '$vale_pago_id') |
| 3818 | UNION ALL |
| 3819 | (SELECT |
| 3820 | d.vale_id AS link_id, |
| 3821 | d.banco_cuenta_mov_link_id, |
| 3822 | d.origen, |
| 3823 | d.vale_id AS doc_id, |
| 3824 | d.cuentaT_id, |
| 3825 | d.tienda_id, |
| 3826 | d.fecha, |
| 3827 | d.banco_cuenta_id, |
| 3828 | d.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 3829 | d.deposit_total AS deposit_total, |
| 3830 | d.quantity_total AS quantity_total, |
| 3831 | d.ide_amount, |
| 3832 | d.ide_percent, |
| 3833 | d.quantity_total AS egreso, |
| 3834 | 0.00 AS monto, |
| 3835 | d.tipo_cash_nota, |
| 3836 | d.cash_nota_num, |
| 3837 | d.deposit_fecha, |
| 3838 | IF((d.deposit_cliente is null OR d.deposit_cliente=''),IF((d.cliente_id is null),d.cliente,cliente.nombre), d.deposit_cliente) AS cliente, |
| 3839 | d.factura, |
| 3840 | d.factura_numero, |
| 3841 | d.iva_incluido AS iva_incluido, |
| 3842 | d.ivacobradox100, |
| 3843 | IF((d.iva_incluido = 'SI'),0.00,d.ivacobradototal) AS ivarealmentecobrado, |
| 3844 | IF((d.iva_incluido = 'NO'),0.00,d.ivacobradototal) AS ivacobradototal, |
| 3845 | d.alta_db, |
| 3846 | d.alta_por, |
| 3847 | d.numero_referencia AS numero_referencia, |
| 3848 | d.cash_num_cobro_iva, |
| 3849 | d.empresa_id, |
| 3850 | d.remarks, |
| 3851 | 'NO' AS puede_borrar, |
| 3852 | IF((d.cancelado = 1),'No','Si') AS activo, |
| 3853 | d.afecta_cuentat AS afecta_cuentat, |
| 3854 | d.comments AS comments, |
| 3855 | d.autorizado AS autorizado, |
| 3856 | d.rechazado AS rechazado, |
| 3857 | d.revisado AS revisado, |
| 3858 | d.autorizado_el AS autorizado_el, |
| 3859 | d.autorizado_por AS autorizado_por, |
| 3860 | d.MetodoPago AS MetodoPago, |
| 3861 | d.FormaPago AS FormaPago, |
| 3862 | d.UsoCFDI AS UsoCFDI, |
| 3863 | d.iva_revisado AS iva_revisado, |
| 3864 | d.iva_revisado_por AS iva_revisado_por, |
| 3865 | d.iva_revisado_el AS iva_revisado_el, |
| 3866 | d.ultimo_cambio, |
| 3867 | d.ultimo_cambio_por, |
| 3868 | d.cliente_rfc, |
| 3869 | d.referencia, |
| 3870 | d.cuenta_t_mov_id AS origen_mov_id, |
| 3871 | 'NO' AS factura_directa, |
| 3872 | d.recibido_moneda_id AS moneda_id, |
| 3873 | d.fecha_capturado AS fecha_capturado, |
| 3874 | d.json_file_attachments AS json_file_attachments, |
| 3875 | d.cancelacion_revisada, |
| 3876 | d.cancelacion_revisada_por, |
| 3877 | d.cancelacion_revisada_el, |
| 3878 | d.cancelacion_el |
| 3879 | FROM vale d LEFT JOIN cliente ON(d.cliente_id = cliente.cliente_id) |
| 3880 | WHERE d.banco_cuenta_id > 0 AND d.banco_cuenta_mov_link_id <> '' AND d.vale_id <> '' AND d.vale_id = '$vale_id') |
| 3881 | UNION ALL |
| 3882 | (SELECT |
| 3883 | l.vale_id AS link_id, |
| 3884 | l.banco_cuenta_mov_link_id, |
| 3885 | l.origen, |
| 3886 | l.vale_id AS doc_id, |
| 3887 | l.cuentaT_id, |
| 3888 | l.tienda_id, |
| 3889 | l.fecha, |
| 3890 | l.banco_cuenta_id, |
| 3891 | l.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 3892 | l.deposit_total AS deposit_total, |
| 3893 | l.quantity_total AS quantity_total, |
| 3894 | l.ide_amount, |
| 3895 | l.ide_percent, |
| 3896 | l.quantity_total AS egreso, |
| 3897 | 0.00 AS monto, |
| 3898 | l.tipo_cash_nota, |
| 3899 | l.cash_nota_num, |
| 3900 | l.deposit_fecha, |
| 3901 | IF((l.deposit_cliente is null OR l.deposit_cliente=''),IF((l.cliente_id is null),l.cliente,cliente.nombre), l.deposit_cliente) AS cliente, |
| 3902 | l.factura, |
| 3903 | l.factura_numero, |
| 3904 | l.iva_incluido AS iva_incluido, |
| 3905 | l.ivacobradox100, |
| 3906 | IF((l.iva_incluido = 'SI'),0.00,l.ivacobradototal) AS ivarealmentecobrado, |
| 3907 | IF((l.iva_incluido = 'NO'),0.00,l.ivacobradototal) AS ivacobradototal, |
| 3908 | l.alta_db, |
| 3909 | l.alta_por, |
| 3910 | l.numero_referencia AS numero_referencia, |
| 3911 | l.cash_num_cobro_iva, |
| 3912 | l.empresa_id, |
| 3913 | l.remarks, |
| 3914 | 'NO' AS puede_borrar, |
| 3915 | 'No' AS activo, |
| 3916 | l.afecta_cuentat AS afecta_cuentat, |
| 3917 | l.comments AS comments, |
| 3918 | l.autorizado AS autorizado, |
| 3919 | l.rechazado AS rechazado, |
| 3920 | l.revisado AS revisado, |
| 3921 | l.autorizado_el AS autorizado_el, |
| 3922 | l.autorizado_por AS autorizado_por, |
| 3923 | l.MetodoPago AS MetodoPago, |
| 3924 | l.FormaPago AS FormaPago, |
| 3925 | l.UsoCFDI AS UsoCFDI, |
| 3926 | l.iva_revisado AS iva_revisado, |
| 3927 | l.iva_revisado_por AS iva_revisado_por, |
| 3928 | l.iva_revisado_el AS iva_revisado_el, |
| 3929 | l.ultimo_cambio, |
| 3930 | l.ultimo_cambio_por, |
| 3931 | l.cliente_rfc, |
| 3932 | l.referencia, |
| 3933 | l.cuenta_t_mov_id AS origen_mov_id, |
| 3934 | 'NO' AS factura_directa, |
| 3935 | l.recibido_moneda_id AS moneda_id, |
| 3936 | l.fecha_capturado AS fecha_capturado, |
| 3937 | l.json_file_attachments AS json_file_attachments, |
| 3938 | l.cancelacion_revisada, |
| 3939 | l.cancelacion_revisada_por, |
| 3940 | l.cancelacion_revisada_el, |
| 3941 | l.cancelacion_el |
| 3942 | FROM vale_log l LEFT JOIN cliente ON(l.cliente_id = cliente.cliente_id) |
| 3943 | WHERE l.banco_cuenta_id > 0 AND l.vale_id <> '' AND l.vale_id = '$vale_log_id') |
| 3944 | UNION ALL |
| 3945 | (SELECT |
| 3946 | e.cuentat_a_banco_tc_mov_id AS link_id, |
| 3947 | e.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 3948 | e.origen AS origen, |
| 3949 | e.cuentat_a_banco_tc_mov_id AS doc_id, |
| 3950 | e.cuentaT_id AS cuentaT_id, |
| 3951 | e.tienda_id AS tienda_id, |
| 3952 | e.fecha AS fecha, |
| 3953 | e.banco_cuenta_id AS banco_cuenta_id, |
| 3954 | e.cuentaT_tipo_mov_id AS cuentaT_tipo_mov_id, |
| 3955 | e.deposit_total AS quantity_total, |
| 3956 | e.quantity_total AS quantity_total, |
| 3957 | e.ide_amount AS ide_amount, |
| 3958 | e.ide_percent AS ide_percent, |
| 3959 | e.egreso AS egreso, |
| 3960 | e.monto AS monto, |
| 3961 | e.tipo_cash_nota AS tipo_cash_nota, |
| 3962 | e.cash_nota_num AS cash_nota_num, |
| 3963 | e.deposit_fecha AS deposit_fecha, |
| 3964 | e.cliente AS cliente, |
| 3965 | e.factura AS factura, |
| 3966 | e.factura_numero AS factura_numero, |
| 3967 | e.iva_incluido AS iva_incluido, |
| 3968 | e.ivacobradox100 AS ivacobradox100, |
| 3969 | IF((e.iva_incluido = 'SI'),0.00,e.ivacobradototal) AS ivarealmentecobrado, |
| 3970 | IF((e.iva_incluido = 'NO'),0.00,e.ivacobradototal) AS ivacobradototal, |
| 3971 | e.alta_db AS alta_db, |
| 3972 | e.alta_por AS alta_por, |
| 3973 | e.numero_referencia AS numero_referencia, |
| 3974 | e.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 3975 | e.empresa_id AS empresa_id, |
| 3976 | e.remarks AS remarks, |
| 3977 | e.puede_borrar AS puede_borrar, |
| 3978 | e.activo AS activo, |
| 3979 | e.afecta_cuentat AS afecta_cuentat, |
| 3980 | e.comments AS comments, |
| 3981 | e.autorizado AS autorizado, |
| 3982 | e.rechazado AS rechazado, |
| 3983 | e.revisado AS revisado, |
| 3984 | e.autorizado_el AS autorizado_el, |
| 3985 | e.autorizado_por AS autorizado_por, |
| 3986 | e.MetodoPago AS MetodoPago, |
| 3987 | e.FormaPago AS FormaPago, |
| 3988 | e.UsoCFDI AS UsoCFDI, |
| 3989 | e.iva_revisado AS iva_revisado, |
| 3990 | e.iva_revisado_por AS iva_revisado_por, |
| 3991 | e.iva_revisado_el AS iva_revisado_el, |
| 3992 | e.ultimo_cambio AS ultimo_cambio, |
| 3993 | e.ultimo_cambio_por AS ultimo_cambio_por, |
| 3994 | e.cliente_rfc AS cliente_rfc, |
| 3995 | e.referencia AS referencia, |
| 3996 | e.origen_mov_id AS origen_mov_id, |
| 3997 | e.factura_directa AS factura_directa, |
| 3998 | e.moneda_id AS moneda_id, |
| 3999 | e.fecha_capturado AS fecha_capturado, |
| 4000 | e.json_file_attachments AS json_file_attachments, |
| 4001 | e.cancelacion_revisada, |
| 4002 | e.cancelacion_revisada_por, |
| 4003 | e.cancelacion_revisada_el, |
| 4004 | e.cancelacion_el |
| 4005 | FROM cuentat_a_banco_tc e |
| 4006 | WHERE e.cuentat_a_banco_tc_mov_id <> '' AND e.cuentat_a_banco_tc_mov_id = '$cuentat_a_banco_tc_mov_id') |
| 4007 | UNION ALL |
| 4008 | (SELECT |
| 4009 | f.banco_cuenta_trans_id AS link_id, |
| 4010 | f.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 4011 | f.origen AS origen, |
| 4012 | f.banco_cuenta_trans_id AS doc_id, |
| 4013 | f.cuentaT_id AS cuentaT_id, |
| 4014 | f.tienda_id AS tienda_id, |
| 4015 | f.fecha AS fecha, |
| 4016 | f.banco_cuenta_id AS banco_cuenta_id, |
| 4017 | f.cuentaT_tipo_mov_id AS cuentaT_tipo_mov_id, |
| 4018 | f.deposit_total AS quantity_total, |
| 4019 | f.quantity_total AS quantity_total, |
| 4020 | f.ide_amount AS ide_amount, |
| 4021 | f.ide_percent AS ide_percent, |
| 4022 | f.egreso AS egreso, |
| 4023 | f.monto AS monto, |
| 4024 | f.tipo_cash_nota AS tipo_cash_nota, |
| 4025 | f.cash_nota_num AS cash_nota_num, |
| 4026 | f.deposit_fecha AS deposit_fecha, |
| 4027 | f.cliente AS cliente, |
| 4028 | f.factura AS factura, |
| 4029 | f.factura_numero AS factura_numero, |
| 4030 | f.iva_incluido AS iva_incluido, |
| 4031 | f.ivacobradox100 AS ivacobradox100, |
| 4032 | IF((f.iva_incluido = 'SI'),0.00,f.ivacobradototal) AS ivarealmentecobrado, |
| 4033 | IF((f.iva_incluido = 'NO'),0.00,f.ivacobradototal) AS ivacobradototal, |
| 4034 | f.alta_db AS alta_db, |
| 4035 | f.alta_por AS alta_por, |
| 4036 | f.numero_referencia AS numero_referencia, |
| 4037 | f.cash_num_cobro_iva AS cash_num_cobro_iva, |
| 4038 | f.empresa_id AS empresa_id, |
| 4039 | f.remarks AS remarks, |
| 4040 | f.puede_borrar AS puede_borrar, |
| 4041 | f.activo AS activo, |
| 4042 | f.afecta_cuentat AS afecta_cuentat, |
| 4043 | f.comments AS comments, |
| 4044 | f.autorizado AS autorizado, |
| 4045 | f.rechazado AS rechazado, |
| 4046 | f.revisado AS revisado, |
| 4047 | f.autorizado_el AS autorizado_el, |
| 4048 | f.autorizado_por AS autorizado_por, |
| 4049 | f.MetodoPago AS MetodoPago, |
| 4050 | f.FormaPago AS FormaPago, |
| 4051 | f.UsoCFDI AS UsoCFDI, |
| 4052 | f.iva_revisado AS iva_revisado, |
| 4053 | f.iva_revisado_por AS iva_revisado_por, |
| 4054 | f.iva_revisado_el AS iva_revisado_el, |
| 4055 | f.ultimo_cambio AS ultimo_cambio, |
| 4056 | f.ultimo_cambio_por AS ultimo_cambio_por, |
| 4057 | f.cliente_rfc AS cliente_rfc, |
| 4058 | f.referencia AS referencia, |
| 4059 | f.origen_mov_id AS origen_mov_id, |
| 4060 | f.factura_directa AS factura_directa, |
| 4061 | f.moneda_id AS moneda_id, |
| 4062 | f.fecha_capturado AS fecha_capturado, |
| 4063 | f.json_file_attachments AS json_file_attachments, |
| 4064 | f.cancelacion_revisada, |
| 4065 | f.cancelacion_revisada_por, |
| 4066 | f.cancelacion_revisada_el, |
| 4067 | f.cancelacion_el |
| 4068 | FROM banco_cuenta_trans f |
| 4069 | WHERE f.banco_cuenta_trans_id <> '' AND f.banco_cuenta_trans_id = '$banco_cuenta_trans_id') |
| 4070 | UNION ALL |
| 4071 | (SELECT |
| 4072 | g.cheque_pago_log_id AS link_id, |
| 4073 | g.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 4074 | g.origen AS origen, |
| 4075 | g.cheque_id AS doc_id, |
| 4076 | g.cuentaT_id AS cuentaT_id, |
| 4077 | g.tienda_id AS tienda_id, |
| 4078 | g.fecha AS fecha, |
| 4079 | g.banco_cuenta_id AS banco_cuenta_id, |
| 4080 | g.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 4081 | g.deposit_total AS deposit_total, |
| 4082 | g.quantity_total AS quantity_total, |
| 4083 | g.ide_amount AS ide_amount, |
| 4084 | g.ide_percent AS ide_percent, |
| 4085 | g.quantity_total AS egreso, |
| 4086 | 0.00 AS monto, |
| 4087 | g.tipo_cash_nota AS tipo_cash_nota, |
| 4088 | g.cash_nota_num AS cash_nota_num, |
| 4089 | g.deposit_fecha AS deposit_fecha, |
| 4090 | g.cliente AS cliente, |
| 4091 | g.factura AS factura, |
| 4092 | g.factura_numero AS factura_numero, |
| 4093 | 'NO' AS iva_incluido, |
| 4094 | g.ivacobradox100 AS ivacobradox100, |
| 4095 | g.ivacobradototal AS ivarealmentecobrado, |
| 4096 | g.ivacobradototal AS ivacobradototal, |
| 4097 | g.alta_db AS alta_db, |
| 4098 | g.alta_por AS alta_por, |
| 4099 | g.numero_referencia AS numero_referencia, |
| 4100 | null AS cash_num_cobro_iva, |
| 4101 | g.empresa_id AS empresa_id, |
| 4102 | g.comentario AS remarks, |
| 4103 | g.puede_borrar AS puede_borrar, |
| 4104 | g.activo AS activo, |
| 4105 | 'NO' AS afecta_cuentat, |
| 4106 | '' AS comments, |
| 4107 | g.autorizado AS autorizado, |
| 4108 | g.rechazado AS rechazado, |
| 4109 | g.revisado AS revisado, |
| 4110 | g.autorizado_el AS autorizado_el, |
| 4111 | g.autorizado_por AS autorizado_por, |
| 4112 | g.MetodoPago AS MetodoPago, |
| 4113 | g.FormaPago AS FormaPago, |
| 4114 | g.UsoCFDI AS UsoCFDI, |
| 4115 | g.iva_revisado AS iva_revisado, |
| 4116 | g.iva_revisado_por AS iva_revisado_por, |
| 4117 | g.iva_revisado_el AS iva_revisado_el, |
| 4118 | g.ultimo_cambio AS ultimo_cambio, |
| 4119 | g.ultimo_cambio_por AS ultimo_cambio_por, |
| 4120 | '' AS cliente_rfc, |
| 4121 | g.referencia AS referencia, |
| 4122 | '' AS origen_mov_id, |
| 4123 | 'NO' AS factura_directa, |
| 4124 | g.moneda_id AS moneda_id, |
| 4125 | g.alta_db AS fecha_capturado, |
| 4126 | g.json_file_attachments AS json_file_attachments, |
| 4127 | g.cancelacion_revisada, |
| 4128 | g.cancelacion_revisada_por, |
| 4129 | g.cancelacion_revisada_el, |
| 4130 | g.cancelacion_el |
| 4131 | FROM cheque_pago_log g |
| 4132 | WHERE g.banco_cuenta_id > 0 AND g.cheque_pago_log_id <> '' AND g.cheque_pago_log_id = '$cheque_pago_log_id') |
| 4133 | UNION ALL |
| 4134 | (SELECT |
| 4135 | h.pagare_pago_log_id AS link_id, |
| 4136 | h.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 4137 | h.origen AS origen, |
| 4138 | h.pagare_id AS doc_id, |
| 4139 | h.cuentaT_id AS cuentaT_id, |
| 4140 | h.tienda_id AS tienda_id, |
| 4141 | h.fecha AS fecha, |
| 4142 | h.banco_cuenta_id AS banco_cuenta_id, |
| 4143 | h.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 4144 | h.deposit_total AS deposit_total, |
| 4145 | h.quantity_total AS quantity_total, |
| 4146 | h.ide_amount AS ide_amount, |
| 4147 | h.ide_percent AS ide_percent, |
| 4148 | h.quantity_total AS egreso, |
| 4149 | 0.00 AS monto, |
| 4150 | h.tipo_cash_nota AS tipo_cash_nota, |
| 4151 | h.cash_nota_num AS cash_nota_num, |
| 4152 | h.deposit_fecha AS deposit_fecha, |
| 4153 | h.cliente AS cliente, |
| 4154 | h.factura AS factura, |
| 4155 | h.factura_numero AS factura_numero, |
| 4156 | 'NO' AS iva_incluido, |
| 4157 | h.ivacobradox100 AS ivacobradox100, |
| 4158 | ivacobradototal AS ivarealmentecobrado, |
| 4159 | ivacobradototal AS ivacobradototal, |
| 4160 | h.alta_db AS alta_db, |
| 4161 | h.alta_por AS alta_por, |
| 4162 | h.numero_referencia AS numero_referencia, |
| 4163 | null AS cash_num_cobro_iva, |
| 4164 | h.empresa_id AS empresa_id, |
| 4165 | h.comentario AS remarks, |
| 4166 | h.puede_borrar AS puede_borrar, |
| 4167 | h.activo AS activo, |
| 4168 | 'NO' AS afecta_cuentat, |
| 4169 | '' AS comments, |
| 4170 | h.autorizado AS autorizado, |
| 4171 | h.rechazado AS rechazado, |
| 4172 | h.revisado AS revisado, |
| 4173 | h.autorizado_el AS autorizado_el, |
| 4174 | h.autorizado_por AS autorizado_por, |
| 4175 | h.MetodoPago AS MetodoPago, |
| 4176 | h.FormaPago AS FormaPago, |
| 4177 | h.UsoCFDI AS UsoCFDI, |
| 4178 | h.iva_revisado AS iva_revisado, |
| 4179 | h.iva_revisado_por AS iva_revisado_por, |
| 4180 | h.iva_revisado_el AS iva_revisado_el, |
| 4181 | h.ultimo_cambio AS ultimo_cambio, |
| 4182 | h.ultimo_cambio_por AS ultimo_cambio_por, |
| 4183 | '' AS cliente_rfc, |
| 4184 | h.referencia AS referencia, |
| 4185 | '' AS origen_mov_id, |
| 4186 | 'NO' AS factura_directa, |
| 4187 | h.moneda_id AS moneda_id, |
| 4188 | h.alta_db AS fecha_capturado, |
| 4189 | h.json_file_attachments AS json_file_attachments, |
| 4190 | h.cancelacion_revisada, |
| 4191 | h.cancelacion_revisada_por, |
| 4192 | h.cancelacion_revisada_el, |
| 4193 | h.cancelacion_el |
| 4194 | FROM pagare_pago_log h |
| 4195 | WHERE h.banco_cuenta_id > 0 AND h.pagare_pago_log_id <> '' AND h.pagare_pago_log_id = '$pagare_pago_log_id') |
| 4196 | UNION ALL |
| 4197 | (SELECT /*VALE_PAGO_LOG*/ |
| 4198 | k.vale_pago_log_id AS link_id, |
| 4199 | k.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 4200 | k.origen AS origen, |
| 4201 | k.vale_id AS doc_id, |
| 4202 | k.cuentaT_id AS cuentaT_id, |
| 4203 | k.tienda_id AS tienda_id, |
| 4204 | k.fecha AS fecha, |
| 4205 | k.banco_cuenta_id AS banco_cuenta_id, |
| 4206 | k.metodo_pago_id AS cuentaT_tipo_mov_id, |
| 4207 | k.deposit_total AS deposit_total, |
| 4208 | k.quantity_total AS quantity_total, |
| 4209 | k.ide_amount AS ide_amount, |
| 4210 | k.ide_percent AS ide_percent, |
| 4211 | k.quantity_total AS egreso, |
| 4212 | 0.00 AS monto, |
| 4213 | k.tipo_cash_nota AS tipo_cash_nota, |
| 4214 | k.cash_nota_num AS cash_nota_num, |
| 4215 | k.deposit_fecha AS deposit_fecha, |
| 4216 | k.cliente AS cliente, |
| 4217 | k.factura AS factura, |
| 4218 | k.factura_numero AS factura_numero, |
| 4219 | 'NO' AS iva_incluido, |
| 4220 | k.ivacobradox100 AS ivacobradox100, |
| 4221 | ivacobradototal AS ivarealmentecobrado, |
| 4222 | ivacobradototal AS ivacobradototal, |
| 4223 | k.alta_db AS alta_db, |
| 4224 | k.alta_por AS alta_por, |
| 4225 | k.numero_referencia AS numero_referencia, |
| 4226 | '' AS cash_num_cobro_iva, |
| 4227 | k.empresa_id AS empresa_id, |
| 4228 | k.comentario AS remarks, |
| 4229 | k.puede_borrar AS puede_borrar, |
| 4230 | k.activo AS activo, |
| 4231 | 'NO' AS afecta_cuentat, |
| 4232 | '' AS comments, |
| 4233 | k.autorizado AS autorizado, |
| 4234 | k.rechazado AS rechazado, |
| 4235 | k.revisado AS revisado, |
| 4236 | k.autorizado_el AS autorizado_el, |
| 4237 | k.autorizado_por AS autorizado_por, |
| 4238 | k.MetodoPago AS MetodoPago, |
| 4239 | k.FormaPago AS FormaPago, |
| 4240 | k.UsoCFDI AS UsoCFDI, |
| 4241 | k.iva_revisado AS iva_revisado, |
| 4242 | k.iva_revisado_por AS iva_revisado_por, |
| 4243 | k.iva_revisado_el AS iva_revisado_el, |
| 4244 | k.ultimo_cambio AS ultimo_cambio, |
| 4245 | k.ultimo_cambio_por AS ultimo_cambio_por, |
| 4246 | '' AS cliente_rfc, |
| 4247 | k.referencia AS referencia, |
| 4248 | '' AS origen_mov_id, |
| 4249 | 'NO' AS factura_directa, |
| 4250 | k.moneda_id AS moneda_id, |
| 4251 | k.alta_db AS fecha_capturado, |
| 4252 | '' AS json_file_attachments, |
| 4253 | k.cancelacion_revisada, |
| 4254 | k.cancelacion_revisada_por, |
| 4255 | k.cancelacion_revisada_el, |
| 4256 | k.cancelacion_el |
| 4257 | FROM vale_pago_log k |
| 4258 | WHERE k.banco_cuenta_id > 0 AND k.vale_pago_log_id <> '' AND k.vale_pago_log_id = '$vale_pago_log_id') |
| 4259 | UNION ALL |
| 4260 | (SELECT |
| 4261 | i.inversion_reembolso_id AS link_id, |
| 4262 | i.banco_cuenta_mov_link_id AS banco_cuenta_mov_link_id, |
| 4263 | i.origen AS origen, |
| 4264 | i.inversion_id AS doc_id, |
| 4265 | 0 AS cuentaT_id, |
| 4266 | null AS tienda_id, |
| 4267 | i.fecha AS fecha, |
| 4268 | i.banco_cuenta_id AS banco_cuenta_id, |
| 4269 | '22' AS cuentaT_tipo_mov_id, |
| 4270 | i.monto_global_reembolso AS quantity_total, |
| 4271 | i.monto_global_reembolso AS quantity_total, |
| 4272 | 0.00 AS ide_amount, |
| 4273 | 0.00 AS ide_percent, |
| 4274 | i.monto_reembolsado + i.monto_interes AS egreso, |
| 4275 | 0.00 AS monto, |
| 4276 | i.tipo_cash_nota AS tipo_cash_nota, |
| 4277 | i.cash_nota_num AS cash_nota_num, |
| 4278 | i.fecha_deposito AS deposit_fecha, |
| 4279 | i.cliente AS cliente, |
| 4280 | i.factura AS factura, |
| 4281 | i.factura_numero AS factura_numero, |
| 4282 | 'No' AS iva_incluido, |
| 4283 | 0.00 AS ivacobradox100, |
| 4284 | 0.00 AS ivarealmentecobrado, |
| 4285 | 0.00 AS ivacobradototal, |
| 4286 | i.alta_db AS alta_db, |
| 4287 | i.alta_por AS alta_por, |
| 4288 | i.numero_referencia AS numero_referencia, |
| 4289 | null AS cash_num_cobro_iva, |
| 4290 | i.empresa_id AS empresa_id, |
| 4291 | i.remarks AS remarks, |
| 4292 | 'No' AS puede_borrar, |
| 4293 | i.activo AS activo, |
| 4294 | 'NO' AS afecta_cuentat, |
| 4295 | i.comments AS comments, |
| 4296 | i.autorizado AS autorizado, |
| 4297 | i.rechazado AS rechazado, |
| 4298 | i.revisado AS revisado, |
| 4299 | i.autorizado_el AS autorizado_el, |
| 4300 | i.autorizado_por AS autorizado_por, |
| 4301 | i.MetodoPago AS MetodoPago, |
| 4302 | i.FormaPago AS FormaPago, |
| 4303 | i.UsoCFDI AS UsoCFDI, |
| 4304 | 'No' AS iva_revisado, |
| 4305 | '' AS iva_revisado_por, |
| 4306 | null AS iva_revisado_el, |
| 4307 | i.ultimo_cambio AS ultimo_cambio, |
| 4308 | i.ultimo_cambio_por AS ultimo_cambio_por, |
| 4309 | '' AS cliente_rfc, |
| 4310 | '' AS referencia, |
| 4311 | null AS origen_mov_id, |
| 4312 | 'No' AS factura_directa, |
| 4313 | 1 AS moneda_id, |
| 4314 | i.alta_db AS fecha_capturado, |
| 4315 | i.json_file_attachments AS json_file_attachments, |
| 4316 | i.cancelacion_revisada, |
| 4317 | i.cancelacion_revisada_por, |
| 4318 | i.cancelacion_revisada_el, |
| 4319 | i.cancelacion_el |
| 4320 | FROM inversion_reembolso i |
| 4321 | WHERE i.inversion_reembolso_id <> '' AND i.inversion_reembolso_id = '$inversion_reembolso_id');"; |
| 4322 | |
| 4323 | $arr_doc = ia_singleton($sql_doc); |
| 4324 | // |
| 4325 | // echo "<li>$sql_doc"; |
| 4326 | // echo "<pre>".print_r($arr_doc, true)."</pre>"; |
| 4327 | |
| 4328 | $insert_sql = ia_insert('links_al_banco_live', $arr_doc, array(), "", true); |
| 4329 | |
| 4330 | return $insert_sql; |
| 4331 | } |
| 4332 | |
| 4333 | function normaliza_origen_doctos($origen = "", $cancelado = "NO"){ |
| 4334 | if(empty($origen)) |
| 4335 | return ""; |
| 4336 | |
| 4337 | $origen = str_replace(array("gasto", "nota"), "cheque", $origen); |
| 4338 | |
| 4339 | if($origen != "vale") |
| 4340 | $origen = str_replace(array("vale", "link", "cash"), "pago", $origen); |
| 4341 | |
| 4342 | |
| 4343 | $origen = str_replace(" ", "_", $origen); |
| 4344 | |
| 4345 | $_log = ""; |
| 4346 | if(strtoupper($cancelado) == "SI") |
| 4347 | $_log = "_log"; |
| 4348 | |
| 4349 | $arr_equivalentes = array( |
| 4350 | 'cheque'=>'cheque' |
| 4351 | ,'cheque_log'=>'cheque_log' |
| 4352 | ,'pagare'=>'pagare' |
| 4353 | ,'pagare_log'=>'pagare_log' |
| 4354 | ,'vale'=>'vale' |
| 4355 | ,'vale_log'=>'vale_log' |
| 4356 | ,'compra'=>'compra' |
| 4357 | ,'compra_log'=>'compra_log' |
| 4358 | ,'cheque_pago_log'=>'cheque_pago_log' |
| 4359 | ,'pagare_pago_log'=>'pagare_pago_log' |
| 4360 | ,'vale_pago_log'=>'vale_pago_log' |
| 4361 | ,'compra_pago_log'=>'compra_pago_log' |
| 4362 | ,'cuenta_t'=>'cuentat_a_banco' |
| 4363 | ,'cuenta_t_log'=>'cuentat_a_banco' |
| 4364 | ); |
| 4365 | |
| 4366 | return $arr_equivalentes[$origen.$_log]; |
| 4367 | } |
| 4368 | |
| 4369 | function spanAlertMovimientosConWarning() |
| 4370 | { |
| 4371 | $query_cache = "SELECT valor FROM campos_exists WHERE tabla_origen = 'movimiento_divisa' AND tabla_exists = 'con_warning'"; |
| 4372 | $con_warning = ia_singleread($query_cache); |
| 4373 | if ($con_warning === false ) { |
| 4374 | $query = "SELECT COUNT(*) FROM movimiento_divisa WHERE warning = 'SI' ORDER BY alta_db DESC"; |
| 4375 | $con_warning = ia_singleread($query); |
| 4376 | } |
| 4377 | if ($con_warning > 0) |
| 4378 | return '<div type="button" class="alerta_movimeintos_warning parpadea"></div>'; |
| 4379 | |
| 4380 | return ''; |
| 4381 | } |
| 4382 | |
| 4383 | function estadosBodega2Html($estados = [], $current_estado = '0', $con_eventos = true, $onclick='productosGeneralesList.activaEstado(this)', $idContent = null, $rowId = null) |
| 4384 | { |
| 4385 | if (!empty($idContent)) |
| 4386 | $idContent = "id='$idContent'"; |
| 4387 | $estadosHtml = "<div class='dvrd' style='display: inline-flex' $idContent><table class='estadoPersonalizadoRegistro' data-value='$current_estado'><tbody>"; |
| 4388 | $j = 0; |
| 4389 | $defaults = [ |
| 4390 | 'color_inactive' => '#c0c0c0', |
| 4391 | 'background_inactive' => '#ffffff', |
| 4392 | 'color_default' => 'blue', |
| 4393 | 'background_default' => '#ffffff', |
| 4394 | ]; |
| 4395 | $defaults_estados = ['E1', 'E2', 'E3', 'E4', 'E5', 'E6', 'E7', 'E8', 'E9', 'E10', 'E11', 'E12', 'E13', 'E14', 'E15', 'E16', 'E17', 'E18', 'E19', 'E20']; |
| 4396 | foreach ($estados as $key => $estado) { |
| 4397 | // if (in_array($estado['clave'], $defaults_estados)) |
| 4398 | // continue; |
| 4399 | if ($j == 0) { |
| 4400 | $estadosHtml .= "<tr>"; |
| 4401 | } |
| 4402 | $css_color = $defaults['color_inactive']; |
| 4403 | $css_background = $defaults['background_inactive']; |
| 4404 | $activo = 0; |
| 4405 | // if (isset($producto_o_pcolor['estado'])) { |
| 4406 | if ((int)$current_estado & (int)$estado['potencia']) { |
| 4407 | $css_color = $estado['color'] ?? $defaults['color_default']; |
| 4408 | $css_background = $estado['background'] ?? $defaults['background_default']; |
| 4409 | $activo = 1; |
| 4410 | } |
| 4411 | // } |
| 4412 | |
| 4413 | $eventos = ''; |
| 4414 | $cursor = ''; |
| 4415 | $border = ''; |
| 4416 | if ($con_eventos) { |
| 4417 | $eventos = "onmouseover=\"$(this).addClass('ui-state-hover');\" onmouseout=\"$(this).removeClass('ui-state-hover')\" onclick='$onclick'"; |
| 4418 | $cursor = 'cursor:pointer;'; |
| 4419 | } |
| 4420 | |
| 4421 | if (empty($estado['icon'])) { |
| 4422 | $contentTD = "<strong style='vertical-align: middle;'>$estado[clave]</strong>"; |
| 4423 | } else { |
| 4424 | $filter = ''; |
| 4425 | if ($activo == 0) { |
| 4426 | $filter = 'filter: grayscale(100%);'; |
| 4427 | } else { |
| 4428 | $border = 'border: 1px solid ' . ($estado['background'] ?? $defaults['background_default']) . " !important;"; |
| 4429 | } |
| 4430 | $contentTD = "<img src='$estado[icon]' alt='$estado[clave]' width='18' style='$filter vertical-align: middle;' align='center'/>"; |
| 4431 | $css_color = $defaults['color_inactive']; |
| 4432 | // $css_background = $defaults['background_inactive']; |
| 4433 | } |
| 4434 | $estadosHtml.= "<td id='$key' data-rowid='$rowId' |
| 4435 | title='$estado[title]' |
| 4436 | data-activo='$activo' |
| 4437 | data-pos='$estado[posicion]' |
| 4438 | data-orden='$estado[orden]' |
| 4439 | data-colname='origen' |
| 4440 | data-rid='$key' |
| 4441 | data-color='$estado[color]' |
| 4442 | data-background='$estado[background]' |
| 4443 | data-potencia='$estado[potencia]' |
| 4444 | $eventos |
| 4445 | style='width:26px !important; height:23px !important; text-align: center; vertical-align: middle; padding: 0 2px 0 2px !important;$cursor background-color:$css_background;color:$css_color;$border'> |
| 4446 | $contentTD |
| 4447 | </td>"; |
| 4448 | $j++; |
| 4449 | if ($j == 6) { |
| 4450 | $j = 0; |
| 4451 | $estadosHtml .= "</tr>"; |
| 4452 | } |
| 4453 | } |
| 4454 | $estadosHtml .= "</tbody></table></div>"; |
| 4455 | return $estadosHtml; |
| 4456 | } |
| 4457 | |
| 4458 | function array2jsArray($arr) { |
| 4459 | $js = '['; |
| 4460 | foreach($arr as $v) |
| 4461 | if($v === null) |
| 4462 | $js .= 'null,'; |
| 4463 | elseif($v === true) |
| 4464 | $js .= 'true,'; |
| 4465 | elseif($v === false) |
| 4466 | $js .= 'false,'; |
| 4467 | elseif($v === 0) |
| 4468 | $js .= '0,'; |
| 4469 | elseif(is_numeric($v)) |
| 4470 | $js .= $v.','; |
| 4471 | else |
| 4472 | $js .= '"'.str_replace('"','\\"',$v).'",'; |
| 4473 | return $js.']'; |
| 4474 | } |
| 4475 | |
| 4476 | function bodega_id_select($dflt=null, $conTodas=false, $tag='', $selectid='select_toolbar_bodega_id', $con_grupos = true){ |
| 4477 | if($dflt==null) |
| 4478 | $dflt=param('bodega_id'); |
| 4479 | if($conTodas) { |
| 4480 | $todas="<option value='0'>Elige</option>"; |
| 4481 | } else |
| 4482 | $todas=''; |
| 4483 | global $gPermisosbodega; |
| 4484 | $bodegas = $gPermisosbodega->getBodegasActivas(); // $bodegasPuede; // |
| 4485 | $bodegas_y_grupos = json_decode(obtenCatalogo('origen_bodega_grupo_2', true), true); |
| 4486 | |
| 4487 | // dd_($bodega_id, $bodegas_y_grupos); |
| 4488 | $select = ""; |
| 4489 | $select_style = ""; |
| 4490 | |
| 4491 | if(empty($bodegas)) |
| 4492 | return false; |
| 4493 | // dd_($bodegas); |
| 4494 | // $select = array2Select($bodegas, 'bodega_id', 'bodega', null ,'bodega_id', 'TODAS', false, true, [], [], null, false); |
| 4495 | foreach ($bodegas_y_grupos as $bodega) { |
| 4496 | $selected = ''; |
| 4497 | $id = $bodega['origen_bodega_id']; |
| 4498 | $bodega_id_self = $bodega['bodega_id'] ?? ''; |
| 4499 | if(empty($bodega_id_self)) |
| 4500 | continue; |
| 4501 | |
| 4502 | $color = "color:".($bodegas[$bodega_id_self]['color']??'000'); |
| 4503 | |
| 4504 | $strike_text = $bodega_id_self == "74867af2fe60ad6b11ec6d7b3badcba6" /**Bodega amarilla**/ ? " -webkit-text-stroke: 1px black;" : ""; |
| 4505 | |
| 4506 | if ($bodega_id_self == $dflt) { |
| 4507 | $selected = 'selected="true"'; |
| 4508 | $select_style = "style='$color; font-weight: bold; " . ($bodega_id_self == "74867af2fe60ad6b11ec6d7b3badcba6" /**Bodega amarilla**/ ? $strike_text : "") . "'"; |
| 4509 | } |
| 4510 | $select.="<option value='$id' data-bodega_id='$bodega_id_self' style='$color; font-weight: bold; $strike_text' $selected>".($bodega['bodega']??$bodega['label'] )."</option>"; |
| 4511 | // color:$bodega[color]; |
| 4512 | } |
| 4513 | |
| 4514 | if(count($bodegas_y_grupos) === 1) |
| 4515 | $select = "<select class='notSelectize' name='$selectid' id='$selectid' $select_style $tag>" . $select; |
| 4516 | else |
| 4517 | $select = "<select class='notSelectize' name='$selectid' id='$selectid' $select_style $tag><option value='' style='color: black; font-weight: bold'>ELIGE BODEGA</option>" . $select; |
| 4518 | |
| 4519 | $select.="</select>"; |
| 4520 | |
| 4521 | return $select; |
| 4522 | } |
| 4523 | |
| 4524 | function cuentat_es_de($cuentat_id = '') |
| 4525 | { |
| 4526 | $es_de = ""; |
| 4527 | if(empty($cuentat_id)) |
| 4528 | return $es_de; |
| 4529 | |
| 4530 | $es_de = ia_singleread("SELECT es_de FROM cuentat WHERE cuentaT_id=".strit($cuentat_id)); |
| 4531 | |
| 4532 | return $es_de; |
| 4533 | } |
| 4534 | |
| 4535 | function createHtmlForTabBodegaUsuario($id_usuario = '') |
| 4536 | { |
| 4537 | |
| 4538 | if (empty($id_usuario)) |
| 4539 | $id_usuario = $_SESSION['usuario_id']; |
| 4540 | |
| 4541 | $dir_save = dirname(__DIR__, 2)."\\backoffice\\view\\component\\index\\"; |
| 4542 | $file_name = "html_for_tab_bodega_$id_usuario.html"; |
| 4543 | $file_save = $dir_save.$file_name; |
| 4544 | return file_put_contents($file_save, getHtmlTabBodega($id_usuario)); |
| 4545 | } |
| 4546 | |
| 4547 | function getHtmlTabBodega($id_usuario) { |
| 4548 | require(__DIR__ . '/../../backoffice/view/component/index/indexBodega.php'); return; |
| 4549 | global $gPermisadorClick; |
| 4550 | ob_start(); |
| 4551 | ?> |
| 4552 | <style> |
| 4553 | |
| 4554 | DETAILS.default { |
| 4555 | display:unset; |
| 4556 | border-radius:unset; |
| 4557 | padding:unset; |
| 4558 | box-shadow:unset; |
| 4559 | background:unset; |
| 4560 | justify-content:unset; |
| 4561 | margin:unset; |
| 4562 | min-width:unset; |
| 4563 | max-width:unset; |
| 4564 | } |
| 4565 | DETAILS.default:after {none} |
| 4566 | DETAILS.default > summary { |
| 4567 | background:unset; |
| 4568 | left:unset; |
| 4569 | top:unset; |
| 4570 | position:unset; |
| 4571 | width:unset; |
| 4572 | padding:unset; |
| 4573 | border-radius:unset; |
| 4574 | color: darkgreen; |
| 4575 | text-shadow:none; |
| 4576 | } |
| 4577 | |
| 4578 | DETAILS.default > summary::after { |
| 4579 | content:unset; |
| 4580 | margin-left:unset; |
| 4581 | } |
| 4582 | DETAILS.default[open] { |
| 4583 | border-radius:unset; |
| 4584 | padding:unset; |
| 4585 | box-shadow:unset; |
| 4586 | background:unset; |
| 4587 | justify-content:unset; |
| 4588 | } |
| 4589 | DETAILS.default[open] > summary { |
| 4590 | background:unset; |
| 4591 | left:unset; |
| 4592 | top:unset; |
| 4593 | position:unset; |
| 4594 | width:unset; |
| 4595 | padding:unset; |
| 4596 | margin:unset; |
| 4597 | border-radius:unset; |
| 4598 | box-shadow:unset; |
| 4599 | color: darkgreen; |
| 4600 | text-shadow:none; |
| 4601 | } |
| 4602 | DETAILS.default[open] > summary:after { |
| 4603 | content:unset;; |
| 4604 | margin-left: 10px; |
| 4605 | } |
| 4606 | DETAILS.default > DIV { |
| 4607 | margin:1em; |
| 4608 | padding:1em; |
| 4609 | border:1px darkgreen solid; |
| 4610 | } |
| 4611 | </style> |
| 4612 | <fieldset class="flexRow" style="gap:0.5em;margin:0;padding:0;border:none;"> |
| 4613 | <?php |
| 4614 | global $gDebugging; |
| 4615 | $mePregunto = false && $gDebugging && usuarioSupervisaBodega($id_usuario) ? me_pregunto_notas_bodega() : ''; |
| 4616 | $dashboardCount['destino_match'] = ia_singleread( |
| 4617 | "SELECT COUNT(DISTINCT inb.nota_bodega_id) |
| 4618 | FROM inconsistencia_nota_bodega inb |
| 4619 | JOIN nota_bodega nb on inb.nota_bodega_id = nb.nota_bodega_id |
| 4620 | WHERE nb.tipo NOT IN('Cancelada', 'Borrado') AND nb.destino_fuerza_ok = 'No' AND |
| 4621 | inb.estado='activo' AND inb.tipo_inconsistencia IN('clientes','ayudantes','pedido_por')"); |
| 4622 | $trasladoDate = Date('Y-m-d', strtotime('1 month ago') ); |
| 4623 | $dashboardCount['contra_nota'] = ia_singleread( |
| 4624 | "SELECT COUNT(DISTINCT inb.nota_bodega_id) |
| 4625 | FROM inconsistencia_nota_bodega inb |
| 4626 | JOIN nota_bodega nb on inb.nota_bodega_id = nb.nota_bodega_id |
| 4627 | WHERE nb.tipo = 'Traslado' AND nb.traslado_forza_ok = 'No' AND |
| 4628 | inb.estado='activo' AND inb.tipo_inconsistencia IN('contra_nota') |
| 4629 | AND nb.fecha >= " . |
| 4630 | strit($trasladoDate) |
| 4631 | ); |
| 4632 | |
| 4633 | $dashboardCount['numero_compra'] = ia_singleread( |
| 4634 | "SELECT COUNT(DISTINCT inb.nota_bodega_id) |
| 4635 | FROM inconsistencia_nota_bodega inb |
| 4636 | JOIN nota_bodega nb on inb.nota_bodega_id = nb.nota_bodega_id |
| 4637 | WHERE nb.tipo NOT IN('Cancelada', 'Borrado') AND nb.destino_fuerza_ok = 'No' AND |
| 4638 | inb.estado='activo' AND inb.tipo_inconsistencia IN('numero_compra')"); |
| 4639 | |
| 4640 | $son = ia_sqlArrayIndx( |
| 4641 | "SELECT |
| 4642 | CONCAT('bodega_id[]=', b.bodega_id, '&producto_general_id[]=', pg.producto_general_id, '&color_id[]=', c.color_id) as href, |
| 4643 | CONCAT_WS('\t', b.grupo, b.bodega, pg.producto, c.color, |
| 4644 | IF(pb.existencia_rollos < 0 , '<span style=\"color:red\">', '<span>') , pb.existencia_rollos, ' rollos</span>', |
| 4645 | IF(pb.existencia_quantity < 0 , '<span style=\"color:red\">', '<span>') , pb.existencia_quantity, |
| 4646 | u.unidad,'</span>' |
| 4647 | ) as txt, |
| 4648 | r.revisado_el |
| 4649 | FROM producto_bodega pb |
| 4650 | JOIN producto_general pg on pb.producto_general_id = pg.producto_general_id |
| 4651 | JOIN unidades u on pg.unidades_id = u.unidades_id |
| 4652 | JOIN color c on pb.color_id = c.color_id |
| 4653 | JOIN bodega b on pb.bodega_id = b.bodega_id |
| 4654 | |
| 4655 | LEFT OUTER JOIN revisador r ON r.tema = 'tab_bodega_producto_color_raro' AND |
| 4656 | r.id = CONCAT_WS('_', b.bodega_id, pg.producto_general_id, c.color_id) AND r.iac_usr_id='$_SESSION[usuario_id]' |
| 4657 | WHERE b.activo='Si' AND pg.activo='Si' AND c.activo='Si' AND (existencia_rollos < 0 OR existencia_quantity < 0) |
| 4658 | ORDER BY 2"); |
| 4659 | $list = ['']; |
| 4660 | $total = 0; |
| 4661 | $i = 0; |
| 4662 | $prevIndx = 1; |
| 4663 | $prev = ''; |
| 4664 | foreach($son as $data) { |
| 4665 | $href = $data['href']; |
| 4666 | $text = $data['txt']; |
| 4667 | $t = explode("\t", $text); |
| 4668 | if($prev !== $t[0] . ' ' . $t[1]) { |
| 4669 | if(!empty($prev)) { |
| 4670 | $list[$prevIndx -1] = "</div></details>"; |
| 4671 | $list[$prevIndx] = "<details class='default'> |
| 4672 | <summary class='default' style='font-weight:bold;font-size:1.1em'><span style='color:red'>" . |
| 4673 | number_format($i, 0, '', ',') . "</span> $prev</summary><div>"; |
| 4674 | $prevIndx = count($list); |
| 4675 | } |
| 4676 | $prev = $t[0] . ' ' . $t[1]; |
| 4677 | $list[] = ''; |
| 4678 | $list[] = ''; |
| 4679 | $i = 0; |
| 4680 | $list[] = ''; |
| 4681 | $list[] = ''; |
| 4682 | } |
| 4683 | $total++; |
| 4684 | $i++; |
| 4685 | $parts = []; |
| 4686 | parse_str($href, $parts); |
| 4687 | $id = $parts['bodega_id'][0] . '_' . $parts['producto_general_id'][0] . '_' . $parts['color_id'][0]; |
| 4688 | if(empty(empty($data['revisado_el']))) { |
| 4689 | $checked = 'checked="checked"'; |
| 4690 | $title = " title='Lo revisaste el " . mysqlDateTime2display($data['revisado_el']) . "'"; |
| 4691 | } else { |
| 4692 | $title = $checked = ''; |
| 4693 | } |
| 4694 | $list[] = "<input $title type='checkbox' value='$id' $checked onclick=\"revisadorMarca('tab_bodega_producto_color_raro', this)\"> <a href='../bodega/bodega_articulo_rastrea.php?$href&por=trackit' target='_blank' |
| 4695 | style='font-weight:100!important;font-size:0.9em;text-shadow: none'>$text</a>"; |
| 4696 | $list[] = ''; |
| 4697 | } |
| 4698 | unset($list[0]); |
| 4699 | if($total > 0) { |
| 4700 | $list[$prevIndx] = "<details class='default'> |
| 4701 | <summary class='default' style='font-weight:bold;font-size:1.1em'><span style='color:red'>" . |
| 4702 | number_format($i, 0, '', ',') . "</span> $prev</summary><div>"; |
| 4703 | if($prevIndx > 0) |
| 4704 | $list[$prevIndx - 1] = "</div></details>"; |
| 4705 | } |
| 4706 | $negativosList = "<dl><dt>" . implode("<dt>", $list) . "</dt></dl>"; |
| 4707 | $dashboardCount['bodega_negativos'] = $total; |
| 4708 | $desdeNotasRevisar = Date('Y-m-d', strtotime("35 days ago")); |
| 4709 | $son = |
| 4710 | ia_sqlArrayIndx( |
| 4711 | "SELECT |
| 4712 | CONCAT( |
| 4713 | 'producto_general_id[]=', pg.producto_general_id, |
| 4714 | '&color_id[]=', c.color_id, |
| 4715 | '&bodega_id[]=', b.bodega_id, |
| 4716 | '&fecha_min=', DATE_SUB(bed.fecha, INTERVAL 30 DAY) |
| 4717 | ) as href, |
| 4718 | CONCAT_WS('\t',b.grupo, b.bodega, bed.fecha, pg.producto, c. color) as txt, |
| 4719 | r.revisado_el |
| 4720 | FROM bodega_existencia_diaria bed |
| 4721 | JOIN producto_general pg on bed.producto_general_id = pg.producto_general_id |
| 4722 | JOIN color c on bed.color_id = c.color_id |
| 4723 | JOIN bodega b on bed.bodega_id = b.bodega_id |
| 4724 | LEFT OUTER JOIN revisador r ON r.tema = 'tab_bodega_producto_color_raro' AND |
| 4725 | r.id = CONCAT_WS('_', b.bodega_id, pg.producto_general_id, c.color_id) AND r.iac_usr_id='$_SESSION[usuario_id]' |
| 4726 | WHERE bed.fecha >= '$desdeNotasRevisar' AND |
| 4727 | pg.activo = 'Si' AND existencia_quantity<>0 AND existencia_quantity = -1 * salida_quantity AND existencia_rollos = -1 * salida_rollos |
| 4728 | ORDER BY b.grupo, b.bodega, bed.fecha DESC, pg.producto, c. color"); |
| 4729 | $list = ['']; |
| 4730 | $total = 0; |
| 4731 | $i = 0; |
| 4732 | $prevIndx = 1; |
| 4733 | $prev = ''; |
| 4734 | foreach($son as $data) { |
| 4735 | $href = $data['href']; |
| 4736 | $text = $data['txt']; |
| 4737 | $t = explode("\t", $text); |
| 4738 | if($prev !== $t[0] . ' ' . $t[1]) { |
| 4739 | if(!empty($prev)) { |
| 4740 | $list[$prevIndx -1] = "</div></details>"; |
| 4741 | $list[$prevIndx] = "<details class='default'> |
| 4742 | <summary class='default' style='font-weight:bold;font-size:1.1em'><span style='color:red'>" . |
| 4743 | number_format($i, 0, '', ',') . "</span> $prev</summary><div>"; |
| 4744 | $prevIndx = count($list); |
| 4745 | } |
| 4746 | $prev = $t[0] . ' ' . $t[1]; |
| 4747 | $list[] = ''; |
| 4748 | $list[] = ''; |
| 4749 | $i = 0; |
| 4750 | $list[] = ''; |
| 4751 | $list[] = ''; |
| 4752 | } |
| 4753 | $list[] = ''; |
| 4754 | $total++; |
| 4755 | $i++; |
| 4756 | $parts = []; |
| 4757 | parse_str($href, $parts); |
| 4758 | $id = $parts['bodega_id'][0] . '_' . $parts['producto_general_id'][0] . '_' . $parts['color_id'][0]; |
| 4759 | if(empty(empty($data['revisado_el']))) { |
| 4760 | $checked = 'checked="checked"'; |
| 4761 | $title = " title='Lo revisaste el " . mysqlDateTime2display($data['revisado_el']) . "'"; |
| 4762 | } else { |
| 4763 | $title = $checked = ''; |
| 4764 | } |
| 4765 | $list[] = "<input $title type='checkbox' value='$id' $checked onclick=\"revisadorMarca('tab_bodega_producto_color_raro', this)\"> <a href='../bodega/bodega_articulo_rastrea.php?$href' target='_blank' |
| 4766 | style='font-weight:100;font-size:0.9em;text-shadow: none'>$text</a>"; |
| 4767 | $list[] = ''; |
| 4768 | } |
| 4769 | unset($list[0]); |
| 4770 | if($total > 0) { |
| 4771 | $list[$prevIndx] = "<details class='default'> |
| 4772 | <summary class='default' style='font-weight:bold;font-size:1.1em'><span style='color:red'>" . |
| 4773 | number_format($i, 0, '', ',') . "</span> $prev</summary><div>"; |
| 4774 | if($prevIndx > 0) |
| 4775 | $list[$prevIndx - 1] = "</div></details>"; |
| 4776 | } |
| 4777 | $rarosList = "<dl><dt>" . implode("<dt>", $list) . "</dt></dl>"; |
| 4778 | $dashboardCount['raros'] = count($son); |
| 4779 | |
| 4780 | foreach($dashboardCount as &$count) |
| 4781 | $count = empty($count) ? "" : |
| 4782 | "<span style='font-size:1.2em;color:red;font-weight:800'>" . |
| 4783 | number_format($count, 0, '', ',') . |
| 4784 | "</span>"; |
| 4785 | unset($count); |
| 4786 | global $gPermisosbodega; |
| 4787 | |
| 4788 | $bodegas_puede_consultar = $gPermisosbodega->bodegasPuedeConsultarMovimientos(); |
| 4789 | $bodegasHacerMovimientos = $gPermisosbodega->bodegasPuedeHacerMovimientos(); |
| 4790 | $puede_consultar_Existencias = puedePermisoUsuario($id_usuario, nombrePermiso: "puede_consultar_existencia"); |
| 4791 | $puede_editar_campos_cash_nota_bodega = puedePermisoUsuario($id_usuario, nombrePermiso: 'puede_editar_campos_cash_nota_bodega'); |
| 4792 | $usuarioTipoRony = usuarioTipoRony(); |
| 4793 | $bodegas_tab = true; |
| 4794 | |
| 4795 | //dd_($bodegasHacerMovimientos); |
| 4796 | if ($bodegas_tab || !empty($bodegas_puede_consultar) || !empty($bodegasHacerMovimientos)) { ?> |
| 4797 | <fieldset style="margin:0;padding:0.5em 0.3em;border-color:blue" class="indexBodegasPrincipal backgroundBodegasPrincipal"> |
| 4798 | <legend class="indexLegendBodegasPrincipal">Bodegas Principales</legend> |
| 4799 | <ul class="tab tabBodega" style="padding-left:2em;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);transition: 0.3s;"> |
| 4800 | |
| 4801 | <?php |
| 4802 | |
| 4803 | if (!empty($bodegas_puede_consultar)) { |
| 4804 | echo '<li><a class="txt_shadow_naranja txt_1_1em tooltip_toolbar" href="nota_bodega.php">Consultar Notas</a> <a class="txt_shadow_olivo tooltip_toolbar" href="nota_bodega.php?container=si">Entrada de Contenedor</a></li><br/>'; |
| 4805 | } |
| 4806 | |
| 4807 | if($bodegas_tab || usuarioSupervisaBodega($id_usuario)) { |
| 4808 | echo '<li><a class="txt_shadow_verde tooltip_toolbar" href="../bodega/bodega_reporte_ventas.php">Reporte: Ventas de Bodega</a>'; |
| 4809 | echo '<a href="../bodega/reporte_ventas_mensuales.php">🧿 Mensual</a><br /> '; |
| 4810 | } |
| 4811 | |
| 4812 | if ($puede_consultar_Existencias) { |
| 4813 | echo '<li><a class="txt_shadow_azul_marino tooltip_toolbar" href = "javascript:dialogConsultarExistencia.show(true);" > Consultar Existencias Diálogo </a ></li ><br />'; |
| 4814 | } |
| 4815 | |
| 4816 | if(usuarioTipoRony() || Permisador::puede('pedido_china', 'Nada', $id_usuario) !== 'Nada') { |
| 4817 | echo '<li><a class="txt_shadow_rosa tooltip_toolbar" href="../pedido/pedido.php">China</a> ' . $gPermisadorClick; |
| 4818 | echo ' <a class="txt_shadow_rosa tooltip_toolbar" href="../pedido/pedido_items.php?activo=Si&mostrar_en_ventas=Si">Por Artículo</a><br /> '; |
| 4819 | } |
| 4820 | if($puede_consultar_Existencias) { |
| 4821 | echo '<li><a href="producto_bodega.php">Consultar Existencias <span class="txt_bold_brightred">GRID</span></a></li><br/>'; |
| 4822 | } |
| 4823 | |
| 4824 | if($bodegas_tab || !empty($bodegas_puede_consultar) ) { |
| 4825 | if (!empty($bodegas_puede_consultar)) { ?> |
| 4826 | <li><a href="nota_bodega.php">Consultar Notas</a></li><br/> |
| 4827 | <!--<li><a href="nota_bodega.php">Consultar Notas Con Productos</a></li><br/>--> |
| 4828 | <!--<li><a href="nota_bodega.php?modificadas=si">Consultar Notas Modificadas</a></li><br/>--> |
| 4829 | <?php |
| 4830 | } |
| 4831 | ?> |
| 4832 | <li><a class="txt_shadow_naranja txt_1_1em tooltip_toolbar" href='../bodega/destinoMatch2.php?inconsistencia_destino_match%5B%5D=ayudantes&inconsistencia_destino_match%5B%5D=clientes&inconsistencia_destino_match%5B%5D=pedido_por'>Destino Match</a> |
| 4833 | <?php echo $dashboardCount['destino_match']; ?> |
| 4834 | <a href="../bodega/destinoMatch2.php?inconsistencia_destino_match_all=all&inconsistencia_destino_match%5B%5D=ayudantes&inconsistencia_destino_match%5B%5D=clientes&inconsistencia_destino_match%5B%5D=numero_compra&inconsistencia_destino_match%5B%5D=pedido_por" target="_self" title="Destino Match con Números de Compra" class="txt_shadow_violeta txt_1_1em tooltip_toolbar_wohtml"><strong>Con Números de Compra</strong></a> |
| 4835 | <?php echo $dashboardCount['numero_compra']; ?> |
| 4836 | <br/><br/> |
| 4837 | <?php if(usuarioTipoRony() || puedePermisoUsuario($id_usuario, "puede_ver_traslados_match")) { ?> |
| 4838 | <li><a href='../bodega/traslados_match.php?diff_date_min=<?=$trasladoDate?>'>Traslado Match</a> <?=$gPermisadorClick?> |
| 4839 | <?php echo $dashboardCount['contra_nota']; ?> |
| 4840 | </li><br/> |
| 4841 | <?php } ?> |
| 4842 | <?php |
| 4843 | if($dashboardCount['bodega_negativos'] !== '' || $dashboardCount['raros'] !== '') { |
| 4844 | if($dashboardCount['raros'] !== '') |
| 4845 | echo "<li><details class='default'> |
| 4846 | <summary title='desde el $desdeNotasRevisar. Haga Click para desplegar'> |
| 4847 | $dashboardCount[raros] Notas a Revisar Producto/Color ¿Correcto?</summary> |
| 4848 | <div>$rarosList</div> |
| 4849 | </details><br> "; |
| 4850 | if($dashboardCount['bodega_negativos'] !== '') |
| 4851 | echo "<li><details class='default'> |
| 4852 | <summary title='Hazme Click Please'> |
| 4853 | $dashboardCount[bodega_negativos] Artículos con ∃ Negativa |
| 4854 | </summary> |
| 4855 | <div>$negativosList</div></details><br> "; |
| 4856 | } |
| 4857 | ?> |
| 4858 | <?php if (puedePermisoUsuario($id_usuario, nombrePermiso: "puede_autorizar_notas_ultimo_movimiento")): ?> |
| 4859 | <li><a href="../bodega/nota_bodega_autorizacion.php">Autorizaciones</a></li><br/> |
| 4860 | <?php endif;?> |
| 4861 | |
| 4862 | <?php if(!empty($bodegas_puede_consultar)){ ?> |
| 4863 | <li style="color: black !important;"> |
| 4864 | <form class="content_tab_ul_li" method="get" action="../bodega/traslados.php" id="form_traslados_entre_bodegas"> |
| 4865 | <label class="bold" for="origen_label_traslado2" style="color: black">Traslados de </label> |
| 4866 | <input name="origen_label_traslado" id="origen_label_traslado2" type="text" autocomplete="off" class="input inputEntrada" |
| 4867 | data-campo="origen_label_traslado" value=""/> |
| 4868 | <input name="origen_id_traslado" id="origen_id_traslado2" type="hidden" data-campo="bodega_id" value=""/> |
| 4869 | <label for="destino_label_traslado2">A</label> |
| 4870 | <input name="destino_label_traslado" id="destino_label_traslado2" type="text" autocomplete="off" class="input inputEntrada" |
| 4871 | data-campo="destino_label_traslado" value="" /> |
| 4872 | <input name="destino_id_traslado" id="destino_id_traslado2" type="hidden" data-campo="origen_id" value=""/> |
| 4873 | <button>Ver</button> |
| 4874 | </form> |
| 4875 | </li><br/> |
| 4876 | <script> |
| 4877 | <?php |
| 4878 | $catalogos = obtenCatalogos([ 'origen_bodega', 'origen_bodega_grupo_2']); |
| 4879 | $destinos_bodegas = json_decode($catalogos['origen_bodega_grupo_2'], true); |
| 4880 | ?> |
| 4881 | var destinos = <?=json_encode($destinos_bodegas)?>; |
| 4882 | $d.initAutoComplete('#origen_label_traslado2', destinos, '#origen_id_traslado', null, 120, 'origen', true); |
| 4883 | $d.initAutoComplete('#destino_label_traslado2', destinos, '#destino_id_traslado', null, 120, 'origen', true); |
| 4884 | </script> |
| 4885 | <?php |
| 4886 | } |
| 4887 | if (!empty($bodegas_puede_consultar)){ ?> |
| 4888 | |
| 4889 | <li><a href="../bodega/inconsistencias_notas.php">Inconsistencias de Notas</a> |
| 4890 | <span style="font-size: larger;cursor:pointer;color: blueviolet;" title="Que genera una inconsistencia" onclick="helpOpen2()">❔ |
| 4891 | <sup style="font-size:0.3em;vertical-align:top">Ayuda</sup></span> |
| 4892 | <?php |
| 4893 | if(usuarioSupervisaBodega($id_usuario)) |
| 4894 | echo ' <a href="../bodega/reporte_incosistencias_tipo.php">🧿 Totales</a>'; |
| 4895 | } |
| 4896 | |
| 4897 | echo "<br/> "; |
| 4898 | |
| 4899 | |
| 4900 | |
| 4901 | |
| 4902 | |
| 4903 | |
| 4904 | if($bodegas_tab || usuarioSupervisaBodega($id_usuario)) { |
| 4905 | echo '<li><a href="../bodega/bodega_articulo_rastrea.php">Reporte: Artículo-color</a><br /> '; |
| 4906 | echo '<li><a href="../bodega/bodega_reporte_numero_notas.php">🧿 Totales Bodega a Destino</a><br /> '; |
| 4907 | } |
| 4908 | |
| 4909 | if(usuarioSupervisaBodega($id_usuario)) { |
| 4910 | echo '<li><a href="../bodega/grid_recaptura_por_usuario.php">Errores por Usuario</a> '; |
| 4911 | echo ' <a href="../bodega/reporte_recaptura_por_usuario.php">🧿 Totales</a> '; |
| 4912 | echo "</lI><br/>"; |
| 4913 | } |
| 4914 | } |
| 4915 | $list_entradas = ''; |
| 4916 | if(!empty($bodegasHacerMovimientos)) {?> |
| 4917 | <li style=" list-style: none;"> |
| 4918 | <details class="bodega" id="lista_entrada_salida_bodegas"> |
| 4919 | <summary class="Bodegas_titIndex"> Nueva nota</summary> |
| 4920 | <div class="flexRow" style="gap:0.2em; justify-content: space-evenly;"> |
| 4921 | <div class="flexItem flexItemBodega"> |
| 4922 | <ul class="tab tabBodega bodega_boxSalida"> |
| 4923 | <li><h3 style="margin: 0">Salida</h3> |
| 4924 | <?php foreach ($bodegasHacerMovimientos as $key => $bodega) { |
| 4925 | // $sigNum = NotaBodega::getSiguienteNumero($key, 500); |
| 4926 | $list_entradas .= "<li style='margin-top: 1.3em;color:$bodega[color]'>" . getLabelBodega($bodega, [ |
| 4927 | 'isAnchor' => true, |
| 4928 | 'urlAnchor' => "../bodega/alta_movimiento.php?bodega_id=".urlencode($key)."&movimientode=entrada", |
| 4929 | 'titleAnchor' => "Nueva Entrada en " . ia_htmlentities($bodega['bodega']) |
| 4930 | ]) . // " [$sigNum]" . implode(", ", NotaBodega::numerosDeNotasFaltantes($key, 0, false)) . |
| 4931 | "</li>"; |
| 4932 | ?> |
| 4933 | <?php } // foreach ($bodegasHacerMovimientos) ?> |
| 4934 | <?=str_replace(['entrada', 'Entrada'], ['salida', 'Salida'], $list_entradas)?> |
| 4935 | </ul> |
| 4936 | </div> |
| 4937 | <div class="flexItem flexItemBodega"> |
| 4938 | <ul class="tab tabBodega bodega_boxEntrada"> |
| 4939 | <li><h3 style="margin: 0;">Entrada</h3> |
| 4940 | <?=$list_entradas?> |
| 4941 | </ul> |
| 4942 | </div> |
| 4943 | </div> |
| 4944 | </details> |
| 4945 | |
| 4946 | <?php } // if(!empty($bodegasHacerMovimientos)) ?> |
| 4947 | |
| 4948 | |
| 4949 | <?php |
| 4950 | $totalFaltan = 0; |
| 4951 | $resumen = bodegasResumenNumeroNotas($bodegas_puede_consultar, $bodegasHacerMovimientos, $totalFaltan); |
| 4952 | if($totalFaltan) { |
| 4953 | $resumenExtra = "<span style='color:red;font-weight: 800'>Faltan de Capturar: " . |
| 4954 | number_format($totalFaltan, 0, ',', '') . "</span>"; |
| 4955 | $ok = "<span style='color:red;font-size:2em;'>✗</span>"; |
| 4956 | $okGrande = ''; |
| 4957 | } else { |
| 4958 | $resumenExtra = '¡Ok!'; |
| 4959 | $okGrande = $ok = "<span style='color:green;font-size:2em;'>✔</span>"; |
| 4960 | } |
| 4961 | if(!empty($bodegasHacerMovimientos)) { |
| 4962 | echo "<details class='bodega' id='resumenBodegasNotas' style='min-width: 400px'> |
| 4963 | <summary class='Bodegas_titIndex'>$ok Captura de Notas: $resumenExtra</summary> |
| 4964 | <div id='resumenBodegasNotasParaWidth' style='min-width: 400px;display:flex;align-items: center'> |
| 4965 | <ul class='tab tabBodega bodega_boxResumen' id='resumenBodegasNotasParaWidth'>" . |
| 4966 | $resumen . |
| 4967 | "</ul> |
| 4968 | <div style='vertical-align: middle;color:green;font-size:3em;'>$okGrande</div> |
| 4969 | </div> |
| 4970 | </details>"; |
| 4971 | } |
| 4972 | ?> |
| 4973 | |
| 4974 | </ul> |
| 4975 | <?php echo $mePregunto; ?> |
| 4976 | </fieldset> |
| 4977 | <?php } else { |
| 4978 | if(puedePermisoUsuario($id_usuario, nombrePermiso: 'puede_editar_campos_cash_nota_bodega')) |
| 4979 | echo <<<HTML |
| 4980 | <fieldset style="margin:0;padding:0.5em 0.3em;border-color:blue" class="indexBodegasPrincipal backgroundBodegasPrincipal"> |
| 4981 | <legend class="indexLegendBodegasPrincipal">Campos Cash</legend> |
| 4982 | <ul class="tab tabBodega" style="padding-left:2em;box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);transition: 0.3s;"> |
| 4983 | <li><a href='../bodega/destinoMatch2.php?fecha_min_viewdate=&fecha_min=&fecha_max=&inconsistencia_destino_match%5B%5D=ayudantes&inconsistencia_destino_match%5B%5D=clientes&inconsistencia_destino_match%5B%5D=pedido_por'>Destino Match</a></li><br/> |
| 4984 | </ul> |
| 4985 | </fieldset> |
| 4986 | HTML; |
| 4987 | else |
| 4988 | // espacio para que no cambie de lugar fieldset de verificacion |
| 4989 | echo "<div style='min-width:25em;width:25em'> </div>"; |
| 4990 | } |
| 4991 | $bodegas_puede_consultar_verificaciones = $gPermisosbodega->bodegasPuedeConsultarVerificarMovimientos(); |
| 4992 | $bodegasHacerMovimientosVerificaciones = $gPermisosbodega->bodegasPuedeHacerVerificarMovimientos(); |
| 4993 | $grupos_verificacion = GruposVerificacion::obtenGruposYBodegasPuedeUsuario($id_usuario); |
| 4994 | if (!empty($bodegas_puede_consultar_verificaciones) || !empty($bodegasHacerMovimientosVerificaciones)) { ?> |
| 4995 | <fieldset class="indexVerificacion backgroundVerificacion" style="margin:0;padding:0.1em 0.1em;"> |
| 4996 | <legend class="indexLegendVerificacion">Verificación</legend> |
| 4997 | <ul class="tab tabBodega indexVerificacion" > |
| 4998 | <?php if(!empty($bodegas_puede_consultar_verificaciones) ) { ?> |
| 4999 | <li><!--suppress HtmlUnknownTarget --> |
| 5000 | <a href="nota_bodega_verificacion.php">Consultar Verificaciones</a></li><br/> |
| 5001 | <li><a href="nota_bodega.php?sin_verificar=si">Notas con NIGUNA verificación</a></li><br/> |
| 5002 | <?php } |
| 5003 | // $bodegasHacerMovimientosVerificaciones = $gPermisosbodega->bodegasPuedeHacerVerificarMovimientos(); |
| 5004 | $list_salidas = ''; |
| 5005 | $list_entradas = ''; |
| 5006 | if(!empty($grupos_verificacion)){ |
| 5007 | $noCuadran = GruposVerificacion::obtenCuantasNotasNoCuadran(); |
| 5008 | |
| 5009 | // dd_($bodegasHacerMovimientosVerificaciones); |
| 5010 | foreach ($grupos_verificacion as $grupo_verificacion_id => $elAgrupado) { |
| 5011 | $noCuadranPorBodega = GruposVerificacion::obtenCuantsNotasNoCuadranPorBodega($grupo_verificacion_id); |
| 5012 | $faltanPorBodega = GruposVerificacion::obtenCuantasNotasFaltanPorBodegaEntradaSalida($grupo_verificacion_id); |
| 5013 | $faltanPorVerificar = number_format( array_sum($faltanPorBodega), 0, '', ','); |
| 5014 | if($faltanPorVerificar !== '0') |
| 5015 | $faltanPorVerificar = "<span style='color:red;font-weight: bold;font-size:larger'>$faltanPorVerificar</span>"; |
| 5016 | if(($noCuadran[$grupo_verificacion_id] ?? 0) > 0) |
| 5017 | $noCuadranNum = "<span style='color:red;font-weight: bold;font-size:larger'>" . number_format( $noCuadran[$grupo_verificacion_id] ?? 0, 0, '', ',') . "</span>"; |
| 5018 | else |
| 5019 | $noCuadranNum = '0'; |
| 5020 | |
| 5021 | $list_salidas = ''; |
| 5022 | $list_entradas = ''; |
| 5023 | ?> |
| 5024 | <?php $nombreGrupoVerificador = GruposVerificacion::getField('grupo_verficiador', $grupo_verificacion_id); ?> |
| 5025 | <fieldset class="indexVerificacion" id="grp_Verificacion" style="margin:0;padding:0.1em 0.1em;"> |
| 5026 | <legend class="indexVerificacion">Lugar: <span class="txtTituloLugar"><?php echo $nombreGrupoVerificador . |
| 5027 | "<span style='font-weight:100;font-size:smaller'> |
| 5028 | <a class='hover-underline-animation' href='nota_bodega.php?sin_verificar=si&grupo_verificacion=$grupo_verificacion_id'> Por Capturar!: $faltanPorVerificar</a> |
| 5029 | <a class='hover-underline-animation' href='nota_bodega_verificacion.php?grupo_verificacion=$grupo_verificacion_id&match=no'>No Cuadran: $noCuadranNum</a></span>" ;?> |
| 5030 | </span></legend> |
| 5031 | <li><a href="nota_bodega.php?sin_verificar=si&grupo_verificacion=<?=$grupo_verificacion_id?>">Notas que falta verificar por <?=$nombreGrupoVerificador?></a></li><br/> |
| 5032 | <li><a href="nota_bodega_verificacion.php?grupo_verificacion=<?=$grupo_verificacion_id?>">Notas Verificadas</a></li><br/> |
| 5033 | <details id="bnv_<?=$grupo_verificacion_id?>" class="bodega detailBodegaVerificar"> |
| 5034 | <summary class="Bodegas_titIndex indexVerificacion" > VERIFICACIÓN</summary> |
| 5035 | <div class="flexRow" style="gap:0.01em;"> |
| 5036 | <div class="flexItem flexItemBodega"> |
| 5037 | <ul class="tab tabBodega bodega_boxSalida_Verify"> |
| 5038 | <h3 style="margin: 0">Salida</h3> |
| 5039 | <?php foreach ($elAgrupado as $bodega_id => $bodega) { |
| 5040 | $faltanPorVerificar = number_format( $faltanPorBodega[$bodega_id . '_salida'] ?? 0, 0, '', ','); |
| 5041 | if($faltanPorVerificar !== '0') |
| 5042 | $faltanPorVerificar = "<span style='color:red;font-size:larger;text-shadow: 1px 1px 2px #eaffe9, 0 0 0.1em #ffcba5, 0 0 0.1em #f8f8f8 !important;'>$faltanPorVerificar</span>"; |
| 5043 | |
| 5044 | $noCuadranEnLaBodega = number_format( $noCuadranPorBodega[$bodega_id.'_salida'] ?? 0, 0, '', ','); |
| 5045 | if($noCuadranEnLaBodega !== '0') |
| 5046 | $noCuadranEnLaBodega = "<span style='color:red;font-size:larger'>$noCuadranEnLaBodega</span>"; |
| 5047 | $list_salidas .= "<li style='margin-top: 0.8em;color:$bodega[color]'>" . getLabelBodega($bodega, [ |
| 5048 | 'isAnchor' => true, |
| 5049 | 'urlAnchor' => "../bodega/alta_verificacion.php?bodega_id=".urlencode($bodega_id)."&movimientode=salida&grupo_verificador=".$bodega['bodega_grupo_verificador_id'], |
| 5050 | 'titleAnchor' => "Nueva Salida en " . ia_htmlentities($bodega['bodega']) |
| 5051 | ]) . "<p style='font-size:smaller'><a class='hover-underline-animation' href='nota_bodega.php?sin_verificar=si&grupo_verificacion=$grupo_verificacion_id&bodega_id=$bodega_id&entrada_salida=Salida' style='padding-left: 20px;'> Por capturar: $faltanPorVerificar</a> <a class='hover-underline-animation' href='nota_bodega_verificacion.php?match=no&grupo_verificacion=$grupo_verificacion_id&bodega_id=$bodega_id&entrada_salida=Salida' style='padding-left: 20px;'>No Cuadran: $noCuadranEnLaBodega</a></p></li>"; |
| 5052 | |
| 5053 | $faltanPorVerificar = number_format( $faltanPorBodega[$bodega_id . '_entrada'] ?? 0, 0, '', ','); |
| 5054 | if($faltanPorVerificar !== '0') |
| 5055 | $faltanPorVerificar = "<span style='color:red;font-size:larger;text-shadow: 1px 1px 2px #eaffe9, 0 0 0.1em #ffcba5, 0 0 0.1em #f8f8f8 !important;'>$faltanPorVerificar</span>"; |
| 5056 | $noCuadranEnLaBodega = number_format( $noCuadranPorBodega[$bodega_id.'_entrada'] ?? 0, 0, '', ','); |
| 5057 | if($noCuadranEnLaBodega !== '0') |
| 5058 | $noCuadranEnLaBodega = "<span style='color:red;font-size:larger'>$noCuadranEnLaBodega</span>"; |
| 5059 | $list_entradas .= "<li style='margin-top: 0.8em;color:$bodega[color]'>" . getLabelBodega($bodega, [ |
| 5060 | 'isAnchor' => true, |
| 5061 | 'urlAnchor' => "../bodega/alta_verificacion.php?bodega_id=".urlencode($bodega_id)."&movimientode=entrada&grupo_verificador=".$bodega['bodega_grupo_verificador_id'], |
| 5062 | 'titleAnchor' => "Nueva Entrada en " . ia_htmlentities($bodega['bodega']) |
| 5063 | ]) . "<p style='font-size:smaller'><a class='hover-underline-animation' href='nota_bodega.php?sin_verificar=si&grupo_verificacion=$grupo_verificacion_id&bodega_id=$bodega_id&entrada_salida=Entrada' style='padding-left: 20px;'> Por capturar: $faltanPorVerificar</a> <a class='hover-underline-animation' href='nota_bodega_verificacion.php?match=no&grupo_verificacion=$grupo_verificacion_id&bodega_id=$bodega_id&entrada_salida=Entrada' style='padding-left: 20px;'>No Cuadran: $noCuadranEnLaBodega</a></p></li>"; |
| 5064 | ?> |
| 5065 | <?php } // foreach ($bodegasHacerMovimientosVerificaciones) ?> |
| 5066 | <?php echo $list_salidas; ?> |
| 5067 | </ul> |
| 5068 | </div> |
| 5069 | <div class="flexItem flexItemBodega"> |
| 5070 | <ul class="tab tabBodega bodega_boxEntrada_Verify"> |
| 5071 | <h3 style="margin: 0;">Entrada</h3> |
| 5072 | <?=$list_entradas?> |
| 5073 | </ul> |
| 5074 | </div> |
| 5075 | </div> |
| 5076 | </details> |
| 5077 | </fieldset> |
| 5078 | <br> |
| 5079 | <?Php |
| 5080 | } |
| 5081 | } |
| 5082 | ?> |
| 5083 | </ul> |
| 5084 | </fieldset> |
| 5085 | |
| 5086 | <?php } ?> |
| 5087 | |
| 5088 | <fieldset style="margin:0; margin-top:20px; padding:0.3em 0.3em;border-color:blue"> |
| 5089 | <legend style="color:blue">Catálogos</legend> |
| 5090 | <ul class="tab tabBodega" style="box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);transition: 0.3s;"> |
| 5091 | <?php if(usuarioSupervisaBodega($id_usuario)) { ?> |
| 5092 | <li><a href="bodega.php">Bodegas</a><br /> |
| 5093 | <li><a href="../backoffice/ayudantes.php">Ayudantes y Pedido Por</a><br /> |
| 5094 | <li><a href="../bodega/estado_bodega.php">Estados</a><br /><br /><br /> |
| 5095 | <span>Productos</span> |
| 5096 | <ul class="tab"> |
| 5097 | <li><a href="producto_bodega.php">Productos registrados por Bodega</a><br /> |
| 5098 | <li><a href="producto_general.php">Productos generales</a></li><br/> |
| 5099 | <!-- <li><a href="../bodega/productos_remate_list.php">Cambiar Saldo/Dead Stock, prices</a></li><br/> --> |
| 5100 | <li><a href="../bodega/producto_color_saldo_lento.php">Recomienda Saldo/Lento <span style="font-size:0.7em">🧪 probando</span></a> </lI><br/> |
| 5101 | <li><a href="color.php">Colores de los productos</a><br /> |
| 5102 | </ul> |
| 5103 | <br/><span>Carta Porte</span> |
| 5104 | <ul class="tab"><!--Carta Porte--> |
| 5105 | |
| 5106 | <li><a href="cp_figuratransporte.php">Conductores</a><br /> |
| 5107 | <li><a href="cp_autotransporte.php">Transporte</a><br /> |
| 5108 | <li><a href="cp_cliente.php">Clientes</a><br /> |
| 5109 | <li><a href="cp_cliente_direccion.php">Direcciones</a><br /> |
| 5110 | </ul> |
| 5111 | </ul> |
| 5112 | <?php } else{ ?> |
| 5113 | <li><a href="../backoffice/ayudantes.php">Ayudantes y Pedido Por</a><br /> |
| 5114 | <?php } ?> |
| 5115 | </fieldset> |
| 5116 | |
| 5117 | </fieldset> |
| 5118 | <div id="inconsistenciaCual" style="display: none"><?php echo InconsistenciaNotaBodega::explicaInconcistencias();?></div> |
| 5119 | |
| 5120 | <script> |
| 5121 | function helpOpen2() { |
| 5122 | $("#inconsistenciaCual").dialog({ |
| 5123 | title:'¿Que causa una inconsistencia?', |
| 5124 | width:'fit-content', |
| 5125 | }); |
| 5126 | } |
| 5127 | |
| 5128 | $(document).ready(function(){ |
| 5129 | /*$( "#grp_Verificacion details" ).each(function( index ) { |
| 5130 | if(dialogConsultarExistencia.localStorageGet($(this).attr("id")) === '1'){ |
| 5131 | $("#"+ $(this).attr("id")).attr("open","true"); |
| 5132 | } |
| 5133 | });*/ |
| 5134 | |
| 5135 | // $("#lista_entrada_salida_bodegas").prop('open', dialogConsultarExistencia.localStorageGet("lista_entrada_salida_bodegas") === '1'); |
| 5136 | |
| 5137 | // $("#resumenBodegasNotas").prop('open', dialogConsultarExistencia.localStorageGet("resumenBodegasNotas") === '1'); |
| 5138 | |
| 5139 | $("#consulta_nota_bodega_numero").off('keypress', pata).one('keypress', pata) |
| 5140 | .off('blur', tab_bodega.consulta_nota_bodega_por_bodega_numero) |
| 5141 | .one('blur', tab_bodega.consulta_nota_bodega_por_bodega_numero); |
| 5142 | $("#tab_nota_bodega_consulta_num").prop('disabled', false); |
| 5143 | $("#tab_nota_bodega_consulta_last").prop('disabled', false); |
| 5144 | }); |
| 5145 | /*$(".detailBodegaVerificar").on("toggle", function(){ |
| 5146 | var $detail=$(this), detailID= $detail.attr("id"); |
| 5147 | dialogConsultarExistencia.localStorageSet(detailID,$detail.prop("open") ? '1' : ''); |
| 5148 | });*/ |
| 5149 | /*$("#lista_entrada_salida_bodegas").on("toggle"); |
| 5150 | $("#resumenBodegasNotas").on("toggle", function(){ |
| 5151 | // dialogConsultarExistencia.localStorageSet("resumenBodegasNotas",$(this).prop("open") ? '1' : ''); |
| 5152 | });*/ |
| 5153 | |
| 5154 | /*$("#consulta_nota_bodega_numero").off('keypress', pata).one('keypress', pata) |
| 5155 | .off('blur', tab_bodega.consulta_nota_bodega_por_bodega_numero) |
| 5156 | .one('blur', tab_bodega.consulta_nota_bodega_por_bodega_numero); |
| 5157 | $("#tab_nota_bodega_consulta_num").prop('disabled', false); |
| 5158 | $("#tab_nota_bodega_consulta_last").prop('disabled', false);*/ |
| 5159 | |
| 5160 | function revisadorMarca(tema, element) { |
| 5161 | $.ajax({ |
| 5162 | url:'../backoffice/ajax/revisador.php', |
| 5163 | method:'POST', |
| 5164 | data:{ accion:'marcaRevisado', tema:tema, id:element.value, marca:element.checked ? 1 : 0}, |
| 5165 | dataType:'json', |
| 5166 | }) |
| 5167 | .fail(function(jqXHR, textStatus, errorThrown) { |
| 5168 | console.log("revisadorMarca ajax error", arguments); |
| 5169 | }); |
| 5170 | } |
| 5171 | </script> |
| 5172 | |
| 5173 | <?php |
| 5174 | return ob_get_clean(); |
| 5175 | } |
| 5176 | |
| 5177 | function addAfterKey($add_item, $key, array $array_origin) |
| 5178 | { |
| 5179 | $pos = array_search('add', array_keys($array_origin)); |
| 5180 | if ($pos || $pos == 0) { |
| 5181 | return array_slice($array_origin, 0, $pos+1, true)+ $add_item+ array_slice($array_origin, $pos, null, true); |
| 5182 | } |
| 5183 | return $array_origin; |
| 5184 | } |
| 5185 | |
| 5186 | /** |
| 5187 | * Trae los vales que correspondan al pagaré o cheque que lo pide, filtrados por el cliente del mismo documento. |
| 5188 | * @param $tabla string vale los documentos que se piden |
| 5189 | * @param $id string id del cheque o pagaré |
| 5190 | * @param $data array con el quantity, cliente_id, etc. |
| 5191 | * @param $vDePaso int override para que muestre los clientes de paso |
| 5192 | * @return string |
| 5193 | */ |
| 5194 | function getDocparaVale(string $tabla, string $id, array $data, int $vDePaso): string { |
| 5195 | //global $tiendas; |
| 5196 | global $gIAParametros; |
| 5197 | |
| 5198 | $docsEncontrados = ''; |
| 5199 | $tbl=$tabla; //."_pago"; |
| 5200 | $tblID=$tabla."_id"; |
| 5201 | $extraCte=''; |
| 5202 | $tiendaid='tienda_id,'; |
| 5203 | $vDePaso = $vDePaso==1? ' cliente_de_paso=1' : ''; |
| 5204 | |
| 5205 | if($data['cliente_id']=='') |
| 5206 | { |
| 5207 | if(empty($vDePaso)) |
| 5208 | $cte="(cliente_id IS NULL)"; |
| 5209 | else |
| 5210 | $cte="( $vDePaso )"; |
| 5211 | } |
| 5212 | else |
| 5213 | { |
| 5214 | if(empty($vDePaso)) |
| 5215 | $cte="(cliente_id=".strit($data['cliente_id'])." )"; |
| 5216 | else |
| 5217 | $cte="( $vDePaso )"; |
| 5218 | } |
| 5219 | $selectCliente=''; |
| 5220 | if($tabla=='cheque') { |
| 5221 | $number="numero as numero"; |
| 5222 | $fecha='original_date as fecha'; |
| 5223 | $debe='disponible_para_sustituir as debe'; |
| 5224 | $total_payments='total_payments'; |
| 5225 | $paid='AND paid=0 AND disponible_para_sustituir > 0'; |
| 5226 | $selectCliente=",nombre,cliente_proveedor_id"; |
| 5227 | } |
| 5228 | else { |
| 5229 | $number=$tabla."_number as numero"; |
| 5230 | $fecha='fecha'; |
| 5231 | $debe='quantity as debe'; |
| 5232 | $total_payments='quantity as total_payments'; |
| 5233 | $paid=''; |
| 5234 | } |
| 5235 | if($tabla=='pagare') { |
| 5236 | $debe='disponible_para_sustituir as debe'; |
| 5237 | $total_payments='total_payments'; |
| 5238 | $paid='AND paid=0 AND disponible_para_sustituir > 0'; |
| 5239 | } |
| 5240 | if($tabla=='vale') { |
| 5241 | $uid=$_SESSION['usuario_id']; |
| 5242 | $debe='quantity-total_payments as debe'; |
| 5243 | $total_payments='total_payments'; |
| 5244 | $paid='AND paid=0 AND aplicado=0 AND cancelado=0 AND devuelto=0 AND quantity > total_payments'; |
| 5245 | //$extraCte=" OR (cliente_de_paso=1 AND tienda_id=".strit($data['tienda_id']).") "; |
| 5246 | //$extraCte=" AND (cuentat_id IN (".cuentasTPuede().") OR abierto = '1' OR (vale_id IN (SELECT vale_id FROM vale_permiso WHERE iac_usr_id='$uid' OR tienda_id IN (SELECT tienda_id FROM usuario_cobranza WHERE permiso='editar' AND iac_usr_id='$uid'))))"; |
| 5247 | if(usuarioTipoRony($_SESSION['usuario_id'])) |
| 5248 | $extraCte = ''; |
| 5249 | else |
| 5250 | //CAMBIAPLANTILLATIENDAS |
| 5251 | $extraCte=" AND (cuentat_id IN (".cuentasTPuede('','emitido_por_en_vales').") OR abierto = '1' OR (vale_id IN (SELECT vale_id FROM vale_permiso WHERE iac_usr_id='$uid' OR tienda_id IN (SELECT p.tienda_id FROM plantilla_cobranza p JOIN iac_usr u ON u.plantillatienda_id=p.plantillatienda_id WHERE p.permiso_cobranza='editar' AND u.iac_usr_id='$uid'))))"; |
| 5252 | $selectCliente=",cliente_de_paso,cliente"; |
| 5253 | $tiendaid = 'conversion_tipo_cambio,'; |
| 5254 | //echo "<pre>".$extraCte."</pre>"; |
| 5255 | //die(); |
| 5256 | } |
| 5257 | |
| 5258 | $sql="SELECT $tblID as id,no_aplicable,quantity,$total_payments,$debe,$number,$fecha,$tiendaid moneda_id,cliente_id $selectCliente |
| 5259 | FROM $tabla WHERE ($cte $extraCte) $paid AND $tblID<>".strit($id) . " ORDER BY no_aplicable DESC, vale_number ASC"; |
| 5260 | // echo "<pre>".$sql."</pre>"; |
| 5261 | //die(); |
| 5262 | $arr=ia_sqlArray($sql); |
| 5263 | |
| 5264 | // echo "<pre>arr" . print_r($data, true) . "</pre>"; |
| 5265 | |
| 5266 | $docto_saldo = $data['quantity'] - $data['total_payments']; |
| 5267 | $doc_moneda = $data['moneda_id']; |
| 5268 | |
| 5269 | |
| 5270 | // die(); |
| 5271 | |
| 5272 | //ia_query("INSERT INTO dime(dime) VALUES(".strit($tabla."\r\n$sql"."\r\n").")"); |
| 5273 | if($arr) foreach($arr as $k=>$d) { |
| 5274 | //$tienda= array_key_exists($d['tienda_id'],$tiendas) ? $tiendas[$d['tienda_id']]['clave'] : ''; |
| 5275 | $cliente=''; |
| 5276 | if(!empty($d['cliente_id'])) |
| 5277 | $cliente=ia_singleread("SELECT nombre FROM cliente WHERE cliente_id=".strit($d['cliente_id'])); |
| 5278 | if(array_key_exists('cliente',$d) && !empty($d['cliente']) ) |
| 5279 | $cliente.=" ".ia_htmlentities($d['cliente']); |
| 5280 | if(array_key_exists('cliente_de_paso',$d) && !empty($d['cliente_de_paso']) ) |
| 5281 | $cliente.=" (de paso)"; |
| 5282 | |
| 5283 | |
| 5284 | |
| 5285 | $input_disabled = ""; |
| 5286 | $input_disabled_class = ""; |
| 5287 | |
| 5288 | |
| 5289 | |
| 5290 | if($d['conversion_tipo_cambio'] > 0) { |
| 5291 | $d['debe'] = echonf($d['debe']/* / $d['conversion_tipo_cambio']*/, true, 2, ""); |
| 5292 | $d['moneda_id'] = 2; |
| 5293 | $moneda_final = 'USD'; |
| 5294 | } |
| 5295 | |
| 5296 | if($d['moneda_id']==2) |
| 5297 | $moneda='USD'; |
| 5298 | else |
| 5299 | $moneda='PESOS'; |
| 5300 | |
| 5301 | $moneda_final = $moneda; |
| 5302 | |
| 5303 | $moneda_class_ = $moneda_class = $moneda=='USD'?'lbl_doc_usd':'lbl_doc_pesos'; |
| 5304 | |
| 5305 | $d_quantity = $d['quantity']; |
| 5306 | $d_debe = $d['debe']; |
| 5307 | $d_total_payments = $d['total_payments']; |
| 5308 | $tr_border = "border_transparent"; |
| 5309 | $title_ = ""; |
| 5310 | $input_tag = "input"; |
| 5311 | $val_ = ""; |
| 5312 | $input_hidden = "<input type='hidden' data-conversion_tipo_cambio='$d[conversion_tipo_cambio]' value='$d[conversion_tipo_cambio]' id='acDoc_$tabla"."_conversion_tipo_cambio_$d[id]' />"; |
| 5313 | $input_id = "acDoc_$tabla"."_$d[id]"; |
| 5314 | $input_data_autonumeric = "data-autonumeric=\"{mNum:10,mDec:2,aSep:',',vMin:'0.00',vMax:'$d_debe'}\""; |
| 5315 | // $title_disp = ""; |
| 5316 | |
| 5317 | if($d_debe != $d_quantity){ |
| 5318 | $title_ = "Usado " . echonf($d_total_payments, true) . " $moneda, disponible " . echonf($d_debe, true) ." $moneda."; |
| 5319 | } |
| 5320 | else |
| 5321 | $title_ = "Disponible " . echonf($d_debe, true) ." $moneda."; |
| 5322 | |
| 5323 | if($data['doc_moneda'] == 1 && $d['moneda_id'] == 1 && $d['conversion_tipo_cambio'] > 1) { |
| 5324 | $input_disabled = " disabled=\"disabled\" "; |
| 5325 | $input_disabled_class = "input_disabled"; |
| 5326 | } |
| 5327 | |
| 5328 | if($d['no_aplicable'] == 1){ |
| 5329 | $input_disabled = " disabled=\"disabled\" "; |
| 5330 | $input_disabled_class = ""; |
| 5331 | $d_quantity = $d_debe = 0; |
| 5332 | $tr_border = "border_gray_solid"; |
| 5333 | $moneda_class = "txt_shadow_violeta"; |
| 5334 | $title_ = "Vale no aplicable"; |
| 5335 | $input_tag = "span"; |
| 5336 | $val_ = "NO APLICABLE"; |
| 5337 | $input_hidden = ""; |
| 5338 | $input_id = ""; |
| 5339 | $input_data_autonumeric = ""; |
| 5340 | } |
| 5341 | |
| 5342 | $acta_moneda_id = $d['moneda_id']; |
| 5343 | $acta_tipo_cambio = $d['conversion_tipo_cambio']; |
| 5344 | $acta_tipo_cambio = !$acta_tipo_cambio ? $gIAParametros["tc"] : $acta_tipo_cambio; |
| 5345 | $acta_monto_max = $d_debe; |
| 5346 | $acta_monto_max_ori = $d_debe; |
| 5347 | |
| 5348 | if($acta_moneda_id != $doc_moneda && $acta_tipo_cambio > 0){ |
| 5349 | if($doc_moneda == 1){ |
| 5350 | $acta_monto_max = ($docto_saldo / $acta_tipo_cambio) + $gIAParametros['tolerancia_pago_documentos_usd']; |
| 5351 | } |
| 5352 | else{ |
| 5353 | $acta_monto_max = ($docto_saldo * $acta_tipo_cambio) + $gIAParametros['tolerancia_pago_documentos_pesos']; |
| 5354 | } |
| 5355 | |
| 5356 | } |
| 5357 | else { |
| 5358 | |
| 5359 | if ($acta_moneda_id == 2) { |
| 5360 | $acta_monto_max = $docto_saldo + $gIAParametros['tolerancia_pago_documentos_usd']; |
| 5361 | } else { |
| 5362 | $acta_monto_max = $docto_saldo + $gIAParametros['tolerancia_pago_documentos_pesos']; |
| 5363 | } |
| 5364 | |
| 5365 | } |
| 5366 | $acta_monto_max = $acta_monto_max > $acta_monto_max_ori ? $acta_monto_max_ori : $acta_monto_max; |
| 5367 | $input_monto_maximo = "Máximo a utilizar " . number_format($acta_monto_max, 2, '.', ',') . " $moneda"; |
| 5368 | |
| 5369 | $input_monto_doc = "<$input_tag size=12 type=text class='$moneda_class bold txt_right_aligned txt_1_1em auto ignore-val $input_disabled_class' data-moneda_id='$d[moneda_id]' $input_data_autonumeric name='acDoc_$tabla"."_$d[id]' id='$input_id' data-total='1' value='0.000' data-quantity='$d_quantity' data-debe='$d_debe' data-conversion_tipo_cambio='$d[conversion_tipo_cambio]' data-max='$d_debe' data-min='0' onchange='ia_validate_field(this)' onkeyup='set_monto_max_input_vale(this.id); return true;' onfocus='invalidaTodoslosDemasVales(this.id);' $input_disabled >$val_</$input_tag>$input_hidden"; |
| 5370 | |
| 5371 | $docsEncontrados .= " |
| 5372 | <tr class='$tr_border'> |
| 5373 | <td class='txt_centered' style='height: 32px;'><a class='tooltip_toolbar_wohtml' title='Abrir el Vale' href='../backoffice/vale.php?iah=e&id=$d[id]' target='_blank'><strong class='bold txt_1_1em $moneda_class_'>".ia_htmlentities($d['numero'])."</strong></a>" |
| 5374 | ."<td><strong>$cliente</strong>" |
| 5375 | ."<td class='$moneda_class_ tooltip_toolbar_wohtml' style='text-align:right;' title = '$title_'><strong>".number_format($d['quantity'],2,'.',',')." $moneda</strong>" |
| 5376 | ."<td class='". ($d['conversion_tipo_cambio'] > 1?'txt_color_USD txt_1_1em':'txt_white') ."' style='text-align:right; color:".($d['conversion_tipo_cambio'] > 1?'#319e31':'white').";'><strong>$d[conversion_tipo_cambio]</strong>" |
| 5377 | ."<td class='txt_1_2em txt_right_aligned $moneda_class_' style='text-align:right;'><strong>".number_format($d['debe'],2,'.',',')." $moneda_final</strong>" |
| 5378 | ."<td class='txt_right_aligned' >$input_monto_doc" |
| 5379 | ."<td class='txt_1_2em txt_right_aligned $moneda_class_'><strong id='queda_$d[id]'>".number_format($d['debe'],2,'.',',')."</strong>" |
| 5380 | ."<td class='txt_1em $moneda_class_' style='padding: 0;'><strong>$moneda_final</strong>"; |
| 5381 | } |
| 5382 | |
| 5383 | if($docsEncontrados != '') |
| 5384 | $docsEncontrados = "<tr><th style='width: 80px;'><strong>Vale Number</strong><th style='width:230px;'><strong>Cliente</strong><th style='width:220px; max-width:220px;'><strong>Monto original</strong><th style='width:150px;'><strong>Tipo Cambio</strong><th style='width:220px;max-width:220px;'><strong>Monto disponible</strong><th style='width:220px;'>Usar<th style='width:190px;max-width:190px;'>Saldo<th style='width:40px;max-width:40px;'> <tr><td colspan='8'><hr /></td> ".$docsEncontrados; |
| 5385 | return $docsEncontrados; |
| 5386 | } |
| 5387 | |
| 5388 | function obten_remarks_banco_cuenta_trans($deposito_banco_cuenta_mov_id=""){ |
| 5389 | |
| 5390 | $ret_arr = array( |
| 5391 | 'referencia_destino' => "", |
| 5392 | 'referencia_origen' => "", |
| 5393 | 'sql' => array(), |
| 5394 | |
| 5395 | ); |
| 5396 | |
| 5397 | $sql = array(); |
| 5398 | |
| 5399 | $bcm_id = $bcmd_id = $deposito_banco_cuenta_mov_id; |
| 5400 | |
| 5401 | $sql_link = "SELECT * FROM banco_cuenta_mov_link WHERE link_to='banco_cuenta_mov' AND banco_cuenta_mov_id = ".strit($bcmd_id); |
| 5402 | $bc_link = ia_singleton($sql_link); |
| 5403 | $bcml_id = $bc_link['banco_cuenta_mov_link_id'] ?? ''; |
| 5404 | |
| 5405 | $sql_trans = "SELECT * FROM banco_cuenta_trans WHERE banco_cuenta_mov_link_id = ".strit($bcml_id); |
| 5406 | // echo "<pre>$sql_trans</pre>"; |
| 5407 | $bc_trans = ia_singleton($sql_trans); |
| 5408 | // echo "<pre>vddB" . print_r($bc_trans, true) . "</pre>"; |
| 5409 | $bcmo_id = $bc_link['link'] ?? ''; |
| 5410 | |
| 5411 | //Primero buscamos el movimiento original. Haremos una función mejor. |
| 5412 | $sqlo = "SELECT * FROM banco_cuenta_mov WHERE banco_cuenta_mov_id = ".strit($bcmo_id); |
| 5413 | // echo "<pre>$sqlo</pre>"; |
| 5414 | $bcmo = ia_singleton($sqlo); |
| 5415 | |
| 5416 | |
| 5417 | $refo_ = ""; //$bcmo['remarks'] ?? ''; |
| 5418 | $refo_ = empty($refo_) ? $refo_ : "$refo_<br data-remarks='mitternacht' />"; |
| 5419 | $refo_ = addslashes($refo_); |
| 5420 | |
| 5421 | if(empty($bcmo_id) || strlen($bcmo_id) < 32) |
| 5422 | { |
| 5423 | $arrTransaBancoacciones["Status"] = 'Error'; |
| 5424 | $arrTransaBancoacciones["Error"] = "<strong>LINK NO ACEPTADO.<br/><br/>No se encontró el movimiento origen.</strong>"; |
| 5425 | ia_errores_a_dime(); |
| 5426 | die(json_encode($arrTransaBancoacciones)); |
| 5427 | } |
| 5428 | |
| 5429 | $arrDestino = ia_singleton("SELECT bc.nombre as banco, bc.empresa_id, e.empresa as empresa FROM banco_cuenta bc LEFT OUTER JOIN empresa e ON bc.empresa_id = e.empresa_id WHERE bc.banco_cuenta_id = '$bc_trans[destino_banco_cuenta_id]'"); |
| 5430 | $arrOrigen = ia_singleton("SELECT bc.nombre as banco, bc.empresa_id, e.empresa as empresa FROM banco_cuenta bc LEFT OUTER JOIN empresa e ON bc.empresa_id = e.empresa_id WHERE bc.banco_cuenta_id = '$bc_trans[origen_banco_cuenta_id]'"); |
| 5431 | |
| 5432 | $ctaBancariaDestino = $arrDestino['banco']; |
| 5433 | $ctaBancariaOrigen = $arrOrigen['banco']; |
| 5434 | |
| 5435 | $empresaDestino = $arrDestino['empresa']; |
| 5436 | $empresaOrigen = $arrOrigen['empresa']; |
| 5437 | |
| 5438 | $empidDestino = $arrDestino['empresa_id']; |
| 5439 | $empidOrigen = $arrOrigen['empresa_id']; |
| 5440 | |
| 5441 | $bcmoID = "&banco_cuenta_mov_id=$bcmo_id"; |
| 5442 | $bcmID = "&banco_cuenta_mov_id=$bcm_id"; |
| 5443 | |
| 5444 | $banco_mov_tipo_id = 18; |
| 5445 | |
| 5446 | //Ponemos la descripción de la transferencia. Principalmente por si es con distinta moneda. |
| 5447 | $txt_moneda_origen = $bc_trans['origen_moneda_id'] == 1 ? "PESOS" : "USD"; |
| 5448 | $txt_moneda_destino = $bc_trans['moneda_id'] == 1 ? "PESOS" : "USD"; |
| 5449 | $class_moneda_origen = $bc_trans['origen_moneda_id'] == 1 ? "txt_shadow_azul_marino" : "txt_shadow_verde"; |
| 5450 | $class_moneda_destino = $bc_trans['moneda_id'] == 1 ? "txt_shadow_azul_marino" : "txt_shadow_verde"; |
| 5451 | |
| 5452 | if($empidOrigen != $empidDestino) |
| 5453 | { |
| 5454 | //Datos extra por si es pago de una empresa a otra. |
| 5455 | $cliente = $empresaDestino; |
| 5456 | $factura_numero = "123456"; |
| 5457 | $factura = "FACTURA"; |
| 5458 | $tipo_cash_nota = "OTRO"; |
| 5459 | $cash_nota_num = "NUESTRO"; |
| 5460 | $cliente_rfc = ""; |
| 5461 | $empresa_id = $empidDestino; |
| 5462 | $iva_incluido = "NO"; |
| 5463 | $ivacobradox100 = "0"; |
| 5464 | $ivacobradototal = 0; |
| 5465 | |
| 5466 | $banco_cuenta = ia_singleton("SELECT tipo_inversion_empresa_privada FROM banco_cuenta WHERE banco_cuenta_id = ". strit($ctaBancariaDestino)); |
| 5467 | |
| 5468 | $tipo_inversion_empresa_privada = $banco_cuenta['tipo_inversion_empresa_privada'] ?? 'empresa'; |
| 5469 | |
| 5470 | $txt_factura = "FACTURA"; |
| 5471 | if("privada"){ |
| 5472 | $iva_incluido = "NO"; |
| 5473 | $ivacobradox100 = "0"; |
| 5474 | $ivacobradototal = 0; |
| 5475 | $txt_factura = "SEMANA"; |
| 5476 | $factura = "ASIMILADOS"; |
| 5477 | } |
| 5478 | |
| 5479 | |
| 5480 | $refd = $refo = "<strong class='txt18pxfr txt_bold_red txt_centered' style='min-width: 335px;'>" . strip_tags($bc_trans['referencia'])."</strong>\r\nPAGO DE <a title='$ctaBancariaOrigen' href='../cobranza/edocta.php?ACC=CB&ECO=SI&banco_cuenta_id=$bc_trans[origen_banco_cuenta_id]$bcmoID' target='_blank' class='$class_moneda_origen'><strong>$empresaOrigen</strong></a> A <a title='$empresaDestino' href='../cobranza/edocta.php?ACC=CB&ECO=SI&banco_cuenta_id=$bc_trans[destino_banco_cuenta_id]$bcmID' target='_blank' class='$class_moneda_destino'><strong>$empresaDestino</strong></a>\r\n<br />$txt_factura $factura_numero"; |
| 5481 | |
| 5482 | $banco_mov_tipo_id = 24; |
| 5483 | } |
| 5484 | else |
| 5485 | { |
| 5486 | $cliente = ""; |
| 5487 | $factura_numero = ""; |
| 5488 | $factura = "NUESTRO"; |
| 5489 | $tipo_cash_nota = "OTRO"; |
| 5490 | $cash_nota_num = "PROPIAS"; |
| 5491 | $cliente_rfc = ""; |
| 5492 | $empresa_id = $empidDestino; |
| 5493 | $iva_incluido = "NO"; |
| 5494 | $ivacobradox100 = 0; |
| 5495 | $ivacobradototal = 0; |
| 5496 | |
| 5497 | $refd = $refo = "<strong class='txt18pxfr txt_bold_red txt_centered' style='min-width: 335px;'>TRASPASO ENTRE CUENTAS PROPIAS</strong><br>TRANSFERENCIA ENTRE CUENTAS PROPIAS, DE <a title='$ctaBancariaOrigen' href='../cobranza/edocta.php?ACC=CB&ECO=SI&banco_cuenta_id=$bc_trans[origen_banco_cuenta_id]$bcmoID' target='_blank' class='$class_moneda_origen'><strong>$ctaBancariaOrigen</strong></a> A <a title='$ctaBancariaDestino' href='../cobranza/edocta.php?ACC=CB&ECO=SI&banco_cuenta_id=$bc_trans[destino_banco_cuenta_id]$bcmID' target='_blank' class='$class_moneda_destino'><strong>$ctaBancariaDestino</strong></a>"; |
| 5498 | } |
| 5499 | |
| 5500 | |
| 5501 | |
| 5502 | if($bc_trans['origen_moneda_id']!=$bc_trans['moneda_id']) |
| 5503 | { |
| 5504 | $refd = $refo .= "<br><li>MONTO ORIGEN: <span class='bold $class_moneda_origen'>$ " . echonf($bc_trans['monto_origen'], true) . " $txt_moneda_origen</span><li>MONTO DESTINO: <span class='bold $class_moneda_destino'>$ " . echonf($bc_trans['monto'], true) . " $txt_moneda_destino</span> <li>TIPO DE CAMBIO: <strong>" . echonf($bc_trans['tipo_cambio'], true, 4)."</strong>"; |
| 5505 | } |
| 5506 | else |
| 5507 | { |
| 5508 | $refd = $refo .= "\r\n<br /><li>MONTO: <span class='bold $class_moneda_destino'>$ " . echonf($bc_trans['monto'], true) . " $txt_moneda_destino</span>"; |
| 5509 | } |
| 5510 | |
| 5511 | // $refo = addslashes($refo); |
| 5512 | // $refd = addslashes($refd); |
| 5513 | |
| 5514 | |
| 5515 | |
| 5516 | $ret_arr['referencia_origen'] = "$refo_ $refo"; |
| 5517 | $ret_arr['referencia_destino'] = $refd; |
| 5518 | // echo $refo."<br><hr/>"; |
| 5519 | // echo $refd; |
| 5520 | return $ret_arr; |
| 5521 | } |