function smarty_function_opalo_cotizador($params, &$smarty) { global $sugar_config; $Items = FnCrm::get_items_by_parent($params['parent_type'], $params['parent_id']); if ($Items) { $ItemsOPA = array(); foreach ($Items as $key => $item) { $ItemsOPA[$key]['id'] = $item->id; $ItemsOPA[$key]['referencia'] = $item->referencia; $ItemsOPA[$key]['name'] = $item->name; $ItemsOPA[$key]['cantidad'] = $item->cantidad % 10 == 0 ? number_format($item->cantidad) : rtrim((double) $item->cantidad, '0'); $ItemsOPA[$key]['vr_unit'] = $item->vr_unit % 10 == 0 ? round($item->vr_unit) : rtrim((double) $item->vr_unit, '0'); $ItemsOPA[$key]['vr_total'] = $item->vr_total % 10 == 0 ? round($item->vr_total) : rtrim((double) $item->vr_total, '0'); $ItemsOPA[$key]['rowid_item'] = $item->rowid_item; $ItemsOPA[$key]['bodega_id'] = $item->bodega_id; $ItemsOPA[$key]['bodega'] = $item->bodega; $ItemsOPA[$key]['unidad_medida'] = $item->unidad_medida; $ItemsOPA[$key]['impuestos'] = FnOtros::trunc_number($item->impuestos); $ItemsOPA[$key]['porcentaje_descuento'] = FnOtros::trunc_number($item->porcentaje_descuento); $ItemsOPA[$key]['descuento_moneda'] = FnOtros::trunc_number($item->descuento_moneda); } } $smarty->assign('subtotalField', !empty($params['subtotal']) ? $params['subtotal'] : 'subtotal'); $smarty->assign('impuestosField', !empty($params['impuestos']) ? $params['impuestos'] : 'impuestos'); $smarty->assign('descuentoField', !empty($params['descuento']) ? $params['descuento'] : 'descuento'); $smarty->assign('totalField', !empty($params['total']) ? $params['total'] : 'total'); $smarty->assign('vr_descuento', !empty($params['vr_descuento']) ? FnOtros::trunc_number($params['vr_descuento']) : 0); $smarty->assign('Items', $ItemsOPA); $smarty->assign('params', $params); $smarty->assign('site_url', $sugar_config['site_url']); $html = dataERP($params); $html .= $smarty->fetch("custom/opalo/partials/cotizador_edit.tpl"); return $html; }
function sendMail($sbSolCoId, $bnSupAnou) { $arNombTab = array(1 => 'opalo_cotizaciones_items'); $arSelFiel = array(0 => "opalo_cotizaciones_items.name "); $arWhereFi = array(0 => "opalo_cotizaciones_items.parent_type", 1 => "opalo_cotizaciones_items.parent_id"); $arWhereVa = array(0 => "opalo_solicitudes_cotizacion", 1 => $sbSolCoId); $arJoinFi1 = array(); $arJoinFi2 = array(); $arFielDes = FnCrm::getFields($arNombTab, $arSelFiel, $arWhereFi, $arWhereVa, $arJoinFi1, $arJoinFi2, 0); $arNombTab = array(1 => 'opalo_proveedores_opalo_solicitudes_cotizacion_1_c'); $arSelFiel = array(0 => "opalo_prova919eedores_ida "); $arWhereFi = array(0 => "opalo_prov5077izacion_idb", 1 => "deleted"); $arWhereVa = array(0 => $sbSolCoId, 1 => '0'); $arJoinFi1 = array(); $arJoinFi2 = array(); $arSupplId = FnCrm::getFields($arNombTab, $arSelFiel, $arWhereFi, $arWhereVa, $arJoinFi1, $arJoinFi2, 0); foreach ($arFielDes as $key => $item) { $arFielDes[$key]['proveedores'] = $arSupplId; } $sbAsuntEm = $bnSupAnou->sbMsjHead; $arFromEma['from'] = "*****@*****.**"; $arFromEma['from_name'] = "Juan"; $sbContent = $bnSupAnou->sbMsjBody; FnCrm::sendEmailWithItems(1, $arFielDes, $sbAsuntEm, $sbContent, $arFromEma); }
function smarty_function_opalo_solicitudes_cotizacion_opalo_proveedores($params, &$smarty) { $proveedores = FnCrm::getProveedoresSolicitudCotizacion($params['parent_id']); // echo "<pre>"; print_r($proveedores); echo "</pre>"; die(); $smarty->assign('proveedores', json_encode($proveedores)); if ($params['vista'] == 'detalle') { return $smarty->fetch("custom/opalo/partials/opalo_solicitudes_cotizacion_opalo_proveedores_detail.tpl"); } else { return $smarty->fetch("custom/opalo/partials/opalo_solicitudes_cotizacion_opalo_proveedores_edit.tpl"); // return "Hola"; } }
function smarty_function_opalo_cotizador_solicitudes($params, &$smarty) { $items = FnCrm::getItemsCotizacion($params['parent_id'], $params['parent_type']); // echo "<pre>"; print_r($items); echo "</pre>"; die(); $smarty->assign('items', json_encode($items)); $smarty->assign('params', $params); $smarty->assign('parent_type', $params['parent_type']); if ($params['vista'] == 'detalle') { return $smarty->fetch("custom/opalo/partials/cotizador_solicitudes_detail.tpl"); } else { return $smarty->fetch("custom/opalo/partials/cotizador_solicitudes_edit.tpl"); } }
function printSingleArrayAsDatatable($datos, $cabeceras = false, $table_head = '', $alinear = false, $id, $params = array(), $sbModName = "") { $arIgnoFie = array('nuConsAcu' => 'right', 'boCotApro' => 'left', 'boAprobad' => 'left', 'sbModuTyp' => 'left', 'sbSolTota' => 'right', 'sbSolApro' => 'right', 'sbSolNoAp' => 'right'); if (count($datos) <= 0) { return "No data"; } require_once 'custom/opalo/params/includesForJS.php'; //echo"<pre>",print_r($arIncluJs),"</pre>"; $includesPorFuera = $arIncluJs['includeDatatable']; $estilo = "<style>\n tr td .ff {\n background-color: #F2F2F2;\n border: thin;\n }\n tr td .fo {\n /* background-color: #; */\n border: thin;\n }\n </style>"; $llaves = array(); if (!$cabeceras) { $cabeceras = array_keys($datos[0]); $llaves = array_keys($datos[0]); } else { $llaves = array_keys($cabeceras); } $odd = false; $color_tr = " class='ff' "; $tabla = "<table id='{$id}' {$table_head} class='table' style='width:100%' >\n <thead>"; $tabla .= "<tr class='info'>\n <th>"; $tabla .= implode("</th><th>", $cabeceras); $tabla .= "</th>\n </tr>\n </thead>\n <tbody>"; foreach ($datos as $fila) { if ($odd = !$odd) { $color_tr = " class='fo' "; } else { $color_tr = " class='ff' "; } $tabla .= "<tr>"; foreach ($llaves as $key) { $textoTd = htmlentities(utf8_encode($fila[$key])); $sbAligTyp = "right"; if ($sbModName != "" && !isset($arIgnoFie[$key])) { $sbAligTyp = FnCrm::AlignType($key, $sbModName); } else { if (isset($arIgnoFie[$key])) { $sbAligTyp = $arIgnoFie[$key]; } } $style = "style='text-align: {$sbAligTyp};'"; $tabla .= "<td {$color_tr} {$style}>{$textoTd}</td>"; } $tabla .= "</tr>"; } $tabla .= "</tbody>\n </table>"; return $includesPorFuera . $tabla; }
function smarty_function_opalo_contratos($params, &$smarty) { $arSelFiel = array("*" => "*"); $arWhereFi = array(0 => "parent_id", 1 => "parent_type", 2 => "opalo_cotizaciones_items.proveedor_seleccionado"); $arWhereVa = array(0 => $params['sbSolCoti'], 1 => "opalo_solicitudes_cotizacion", 2 => $params['sbSupplId']); $arTblValu = array(0 => "opalo_items_solicitud_cotizacion", 1 => "opalo_cotizaciones_items"); $arJoinFi1 = array(0 => "opalo_items_solicitud_cotizacion.id_proveedor", 1 => "opalo_items_solicitud_cotizacion.id_item_solicitud"); $arJoinFi2 = array(0 => "opalo_cotizaciones_items.proveedor_seleccionado", 1 => "opalo_cotizaciones_items.id"); $items = FnCrm::getFields($arTblValu, $arSelFiel, $arWhereFi, $arWhereVa, $arJoinFi1, $arJoinFi2); //echo "<pre>",print_r($items),"</pre>"; //die(); $smarty->assign('items', json_encode($items)); $smarty->assign('params', $params); $smarty->assign('parent_type', $params['parent_type']); return $smarty->fetch("custom/opalo/partials/contratos_detail.tpl"); }
function sendMail($sbSolCoId) { $arNombTab = array(1 => 'opalo_cotizaciones_items'); $arSelFiel = array(0 => "opalo_cotizaciones_items.name ", 1 => "opalo_cotizaciones_items.proveedor_seleccionado"); $arWhereFi = array(0 => "opalo_cotizaciones_items.parent_type", 1 => "opalo_cotizaciones_items.parent_id"); $arWhereVa = array(0 => "opalo_solicitudes_cotizacion", 1 => $sbSolCoId); $arJoinFi1 = array(); $arJoinFi2 = array(); $arFielDes = FnCrm::getFields($arNombTab, $arSelFiel, $arWhereFi, $arWhereVa, $arJoinFi1, $arJoinFi2, 0); // foreach ($arFielDes as $key => $value) { $arFielDes[$key]['proveedores'][]['opalo_prova919eedores_ida'] = $value['proveedor_seleccionado']; unset($arFielDes[$key]['proveedor_seleccionado']); } $sbAsuntEm = "Usted fue seleccionado"; $arFromEma['from'] = "*****@*****.**"; $arFromEma['from_name'] = "Juan"; $sbContent = "\n Buenos dias, \n el correo es para informarle que usted fue seleccionado para suministrar los items:\n "; FnCrm::sendEmailWithItems(1, $arFielDes, $sbAsuntEm, $sbContent, $arFromEma); }
function smarty_function_opalo_solicitudes_cotizacion($params, &$smarty) { $proveedores = FnCrm::getProveedoresSolicitudCotizacion($params['parent_id']); $items = FnCrm::getItemsSolicitudCotizacion($params['parent_id'], $params['parent_type']); // echo "<pre>"; print_r($items); echo "</pre>"; die(); //echo "<pre>"; print_r(json_encode($proveedores)); echo "</pre>"; die(); $smarty->assign('proveedores', json_encode($proveedores)); $smarty->assign('items', json_encode($items)); $smarty->assign('params', $params); $smarty->assign('parent_type', $params['parent_type']); if ($params['vista'] == 'detalle') { return $smarty->fetch("custom/opalo/partials/solicitudes_cotizacion_detail.tpl"); } elseif ($params['vista'] == 'edit') { return $smarty->fetch("custom/opalo/partials/solicitudes_cotizacion_edit.tpl"); } else { $arNumeros = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5); $arSuppTem = array(); $criterios = array('Cumplimiento', 'Tiempo', 'Calidad', 'Servicio'); if ($params['jsCalific'] == null) { foreach ($proveedores as $sup) { $arSuppTem[$sup['id']]['nombre'] = $sup['name']; foreach ($criterios as $criterio) { $arSuppTem[$sup['id']]['criterios'][$criterio]['nombre'] = $criterio; $arSuppTem[$sup['id']]['criterios'][$criterio]['valor'] = 1; } } $smarty->assign('arSupCual', json_encode($arSuppTem)); } else { // echo $params['jsCalific']."<br>"; $smarty->assign('arSupCual', html_entity_decode($params['jsCalific'])); } $smarty->assign('arNumeros', json_encode($arNumeros)); return $smarty->fetch("custom/opalo/partials/calificacion_proveedores.tpl"); } /* */ }
function unit_prepararDatos($sbIdSoliCot) { $datos = FnCrm::prepararDatos($sbIdSoliCot); if (isset($sbIdSoliCot['datos']) && isset($sbIdSoliCot['bnSolicit'])) { echo "trajo datos e items, exito<br>"; } else { echo "Fallo<br>"; } }
function sendEmailWithItems($boNeedIte, $arFielDes, $sbAsuntEm, $sbContent, $arFromEma) { foreach ($arFielDes as $key) { foreach ($key['proveedores'] as $llave => $sbSupplId) { $bnSupplie = BeanFactory::getBean('opalo_proveedores', $sbSupplId['opalo_prova919eedores_ida']); $arAddress[] = $bnSupplie->sbEmailAd; } $sbContent .= "<li>" . $key['name'] . "</li>"; } FnCrm::enviarEmail($sbAsuntEm, $sbContent, $arAddress, $arFromEma); }
<?php $modulo = $_REQUEST['module']; $res = FnCrm::getRelationship($modulo); echo json_encode($res);
<?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);
function smarty_function_supItem($params, &$smarty) { $datos = FnCrm::getSupItems($params['sbSupplId']); $cabeceras = array('sbItemNam' => 'Nombre del item'); return FnView::printSingleArrayAsDatatable($datos, $cabeceras, "class='table_toggle table table-striped table-bordered table-hover table-condensed'", true, "tblItemSup"); }
public static function save_amount($bean, $event, $arguments) { if (!isset($_REQUEST['json_data'])) { return; } $parent_type = $bean->module_name; $datos_json = json_decode(html_entity_decode($_REQUEST['json_data']), true); $acum = 0; foreach ($datos_json as $key => $datos) { $acum += $datos['vr_total']; } $arCampos = array(0 => 'amount'); $arValues = array(0 => $acum); $arWhereFi = array(0 => 'id'); $arWhereVa = array(0 => $bean->id); $arJoinFi1 = array(); $arJoinFi2 = array(); FnCrm::setCampos('opalo_solicitudes', $arCampos, $arValues, $arWhereFi, $arWhereVa, $arJoinFi1, $arJoinFi2); }