function smarty_function_mvto_ventas($params, &$smarty) { include "custom/opalo/params/param_mvto_ventas.php"; $cliente = array('rowid' => $params['rowid_cliente'], 'id_sucursal' => $params['id_sucursal']); $combinacion = $combinaciones[$params['pestana']]; $datos = FnErp::getMvtoVentaData($cliente, $combinacion, false, date('Y-m-d', strtotime('-1 year')), date('Y-m-d'), true); //print_r($datos); return FnView::printSingleArray($datos, false, "", true); }
function smarty_function_pedidos_cli_erp($params, &$smarty) { $rowid_cliente = $params['rowid_cliente']; $id_sucursal = $params['id_sucursal']; /*echo "<pre>"; print_r( getPedidos($nit) ); echo "</pre>";*/ $Pedidos = FnErp::getPedidos($rowid_cliente, $id_sucursal); $smarty->assign('Pedidos', $Pedidos); return $smarty->fetch("custom/opalo/partials/pedidos_erp.tpl"); }
function smarty_function_facturacion_or_notscredito_cli_erp($params, &$smarty) { $rowid_cliente = $params['rowid_cliente']; $id_sucursal = $params['id_sucursal']; $tipo = $params['tipo']; $Items = FnErp::getFacturacionOrNotasCredito($rowid_cliente, $id_sucursal, $tipo); /*echo "<pre>"; print_r($Items); echo "</pre>"; die;*/ $smarty->assign('Items', $Items); return $smarty->fetch("custom/opalo/partials/mvtos_erp.tpl"); }
function smarty_function_info_cliente_erp($params, &$smarty) { $rowid_cliente = $params['rowid_cliente']; $id_sucursal = $params['id_sucursal']; $Info = FnErp::getInfoClienteERP($rowid_cliente, $id_sucursal); $Html = '<table class="table table-striped table-bordered table-condensed">'; $Html .= '<thead><tr class="info">'; $Html .= '<th>Cupo disponible</th><th>Condición de Pago</th><th>Descuento por pago</th><th>Lista de Precio</th>'; $Html .= '</tr></thead>'; $Html .= '<tbody><tr>'; $Html .= '<td style="text-align:right">$ ' . number_format($Info[0]['cupo_credito']) . '</td><td style="text-align:center">' . $Info[0]['cond_pago'] . '</td><td>' . utf8_encode($Info[0]['DSCTO']) . '</td><td>' . utf8_encode($Info[0]['LISTA_PRE']) . '</td>'; $Html .= '</tr></tbody>'; $Html .= '</table>'; return $Html; }
<?php extract($_REQUEST); $res = FnErp::getItemsCompras($referencia, $descripcion); echo json_encode($res);
if (isset($opalo_config['idcia_clientes'])) { $idcia = $opalo_config['idcia_clientes']; } else { $idcia = array('1'); } $actualizadas = array(); $query_clientes = "SELECT F201_ROWID_TERCERO, F201_ID_SUCURSAL FROM T201_MM_CLIENTES WHERE F201_ID_CIA IN(" . implode(",", $idcia) . ")"; $result_clientes = $dbErp->query($query_clientes); while ($un_cliente = $dbErp->fetchByAssoc($result_clientes)) { $rowid_tercero = trim($un_cliente['F201_ROWID_TERCERO']); $id_sucursal = trim($un_cliente['F201_ID_SUCURSAL']); $Bean = BeanFactory::getBean('Accounts'); $Accounts = $Bean->get_full_list('', "accounts.rowid_tercero = '" . $rowid_tercero . "' AND accounts.id_sucursal = '" . $id_sucursal . "'"); if (count($Accounts) > 0) { $BeanCliente = $Accounts[0]; $analisis_un_cliente = FnErp::getAnalisisCliente($BeanCliente->rowid_tercero, $BeanCliente->id_sucursal, 1); /* * if ($analisis_un_cliente['p_cupo_credito'] > 0) { echo "<pre>"; print_r($analisis_un_cliente); echo "</pre>"; die(); } /* */ if ($analisis_un_cliente['p_cupo_credito'] > 0) { $BeanCliente->bloqueadocupo = $analisis_un_cliente['p_bloquear_cupo']; $BeanCliente->bloqueadomora = $analisis_un_cliente['p_bloquear_mora']; $BeanCliente->cupo = $analisis_un_cliente['p_cupo_credito']; $BeanCliente->estado_por_sucursal = $analisis_un_cliente['p_ind_estado']; $BeanCliente->save(); $actualizadas[] = array($BeanCliente->id, $BeanCliente->name, $BeanCliente->cupo); } } }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } $Fotos = FnErp::obtenerFotos(); $cont = 0; foreach ($Fotos as $rowid_foto => $row) { FnCrm::registrarFotos($rowid_foto, $row['FOTO'], $row['DESCRIPCION']); $cont++; } $GLOBALS['log']->fatal("Fotos Ejecutadas " . $cont);
public static function printCarteraPorNitCliente($nit_tercero) { include "custom/opalo/params/param_cartera_edades.php"; $edades = $edades_cliente; $data = FnErp::getCarteraPorNitCliente($nit_tercero); $html = "<table id='tablaCarteraCliente' class='table_toggle table table-striped table-bordered table-condensed' style='min-width:600px'><thead><tr class='info'>"; $Totales = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0); for ($i = 0; $i <= count($edades) - 1; $i++) { if ($i == 0) { $html .= "<th>Documento</th>"; $html .= "<th><= {$edades[$i]}</th>"; } elseif ($i >= count($edades) - 1) { $html .= "<th>> {$edades[$i]}</th>"; } else { $html .= "<th> <= {$edades[$i]}</th>"; } } $html .= "</tr></thead><tbody>"; foreach ($data as $key => $row) { $id = explode("&sep;", $key); $DOC = $id[1]; $html .= "<tr>"; $html .= "<td><b><i>" . date('Y/m/d', strtotime($id[0])) . ": </i></b> {$DOC}</td>"; for ($i = 0; $i <= count($edades) - 1; $i++) { $html .= "<td style='text-align:right;'>\$ " . number_format($data[$key][$i], 2) . "</td>"; $Totales[$i] += $data[$key][$i]; } $html .= "</tr>"; } $html .= "\n\t </tbody>\n\t\t <tfoot>\n\t\t\t <tr class='text-right'>\n\t\t\t \t<th style='text-align:left;'>\n\t\t\t \t\t<b>Total:</b>\n\t\t \t\t</th>\n\t\t \t\t<th style='text-align:right;'>\n\t\t \t\t\t\$ " . number_format($Totales[0], 2) . "\n\t\t \t\t</th>\n\t\t \t\t<th style='text-align:right;'>\n\t\t \t\t\t\$ " . number_format($Totales[1], 2) . "\n\t\t \t\t</th>\n\t\t \t\t<th style='text-align:right;'>\n\t\t \t\t\t\$ " . number_format($Totales[2], 2) . "\n\t\t \t\t</th>\n\t\t \t\t<th style='text-align:right;'>\n\t\t \t\t\t\$ " . number_format($Totales[3], 2) . "\n\t\t \t\t</th>\n\t\t \t\t<th style='text-align:right;'>\n\t\t \t\t\t\$ " . number_format($Totales[4], 2) . "\n\t\t \t\t</th>\n\t\t \t</tr>\n\t \t</tfoot>\n\t </table>"; return $html; }
$listas_erp['criterios_clientes'][$plan_id] = FnErp::getCriteriosCliente($plan_id); } //Bodegas $listas_erp['bodegas_facturables'] = FnErp::getBodegas(true); $listas_erp['bodegas'] = FnErp::getBodegas(false); //Listas de precios $listas_erp['lista_precios'] = FnErp::getListaPrecios(); $listas_erp['lista_precios_cop'] = FnErp::getListaPreciosPorMoneda('COP'); $listas_erp['lista_precios_usd'] = FnErp::getListaPreciosPorMoneda('USD'); //Vendedores $listas_erp['vendedores'] = FnErp::getVendedores(); //Companias $listas_erp['companias'] = FnErp::getCompanias(); //Tipos de identificacion $listas_erp['tipo_identificacion_erp'] = FnErp::getTipoIdentificacion(); //Centros de operacion $listas_erp['cos'] = FnErp::getCentrosOperacion(); //Condiciones de pago $listas_erp['condiciones_pago'] = FnErp::getCondicionesPago(); //Motivos de venta $listas_erp['motivos_venta'] = FnErp::getMotivos('501'); //Centros de Costos de venta // $listas_erp['ccostos_venta'] = FnErp::getCentrosDeCostos('0203', 'CV'); //Tipos de cliente $listas_erp['tipo_cliente_erp'] = FnErp::getTiposCliente(); $GLOBALS['log']->fatal("Sync Listas Ejecutada"); if (write_array_to_file("listas_erp", $listas_erp, "custom/opalo/params/listas_erp.php")) { return true; } else { return false; }