🌹🏠🌹？》《》？《》？<?php 
class Orcabe extends Base
{
public $empresa;
public $tdoc;
public $letra;
public $sucur;
public $numero;
public $codigo_cliente;
public $fecha;
public $estado;
public $fc_concepto;
public $bultos;
public $unidades;
public $volumen;
public $otros;
public $nro_track;
public $concepto;
public $fecha_retira;
public $fecha_certifica;

// detalle clientes_emp
public $cod_dest;
public $cliente;
public $direccion;
public $pais;
public $provincia;
public $localidad;
public $cod_postal;
public $cuit;
public $mail;
public $tel;

// Solo detalle para OR.
public $d_id;
public $d_articulo;
public $d_bultos;
public $d_unidades;
public $d_volumen;
public $d_otros;
public $d_estado;
public $d_estado_lectura;

public $error = 0; // falso
public $msg_error;

function __construct($r_empresa,$r_tdoc,$r_letra,$r_sucur,$r_numero)
{  
//$this->conexion        = $r_base;
$this->empresa     = $r_empresa;
$this->tdoc        = $r_tdoc;
$this->letra       = $r_letra;
$this->sucur       = $r_sucur;
$this->numero      = $r_numero;
$this->bultos      = 0;
$this->unidades    = 0;
$this->volumen     = 0;
$this->otros       = 0;
$this->estado      = 2;
$this->d_estado    = $this->estado;
$this->d_estado_lectura = 'N';
$this->nro_track   =  str_pad($r_empresa,3,'0',STR_PAD_LEFT).
                     $r_letra.
                     str_pad($r_sucur,5,'0',STR_PAD_LEFT).
                     str_pad($r_numero,10,'0',STR_PAD_LEFT);

} 

function r_select_orcabe()
{ 
$this->error     = 0;
$this->msg_error = "";
$p_sql="select * from orcabe     
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
  $this->error     = 2;
  $this->msg_error = "01- Error. No se pudo leer [orcabe] !! ";
  return;
}
$row=odbc_fetch_array($resultado);
if (!$row){
  $this->error     = 1;
  $this->msg_error = "02- Error. No se pudo leer [orcabe] !!";
  return;
}
$this->codigo_cliente = $row['codigo_cliente'];
$this->fecha          = date("d-m-Y",strtotime($row['fecha']));
$this->estado        = $row['estado'];
$this->bultos        = $row['bultos'];
$this->unidades      = $row['unidades'];
$this->volumen       = sprintf("%0.6f",$row['volumen']);
$this->otros         = $row['otros'];
$this->fc_concepto   = $row['fc_concepto'];
$this->nro_track     = $row['nro_track'];
$this->concepto      = $row['concepto'];

$this->fecha_retira  = '';
if ( strlen($row['fecha_retira']) > 0 ) {
   $this->fecha_retira  = date("d-m-Y",strtotime($row['fecha_retira']));
}
$this->fecha_certifica  = '';
if ( strlen($row['fecha_certifica']) > 0 ) {
   $this->fecha_certifica  = date("d-m-Y",strtotime($row['fecha_certifica']));
}
odbc_free_result($resultado);

return;
}

function r_select_ordeta()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="select * from ordeta     
 where empresa  = '{$this->empresa}'
   and tdoc     = '{$this->tdoc}'
   and letra    = '{$this->letra}'
   and sucur    = '{$this->sucur}'
   and numero   = '{$this->numero}' 
   and id       = '{$this->d_id}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error     = 2;
   $this->msg_error = "03- Error. No se pudo leer [ordeta] !! ";
   return;
}
$row=odbc_fetch_array($resultado);
if (!$row){
   $this->error     = 1;
   $this->msg_error = "04- Error. No se pudo leer [ordeta] !!";
   return;
}
$this->d_articulo = $row['articulo'];
$this->d_bultos   = $row['bultos'];
$this->d_unidades = $row['unidades'];
$this->d_volumen  = $row['volumen'];
$this->d_otros    = $row['otros'];
$this->d_estado   = $row['estado'];
$this->d_estado_lectura = $row['estado_lectura'];

return;

}

function r_select_orcabe_nro_track()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="select a.* from orcabe a, pdcabe_tracking b     
         where a.nro_track     = b.nro_track
           and b.nro_track_int = '{$this->nro_track}'
           and a.estado     != 99 ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error     = 2;
   $this->msg_error = "05- Error. No se pudo leer [orcabe] !! ";
   return;
}
$row=odbc_fetch_array($resultado);
if (!$row){
   $this->error     = 1;
   $this->msg_error = "06- Error. No se pudo leer [orcabe] !!";
   return;
}
$this->empresa        = $row['empresa'];
$this->letra          = $row['letra'];
$this->tdoc           = $row['tdoc'];
$this->sucur          = $row['sucur'];
$this->numero         = $row['numero'];
$this->codigo_cliente = $row['codigo_cliente'];
$this->fecha          = date("d-m-Y",strtotime($row['fecha']));
$this->estado        = $row['estado'];
$this->bultos        = $row['bultos'];
$this->unidades      = $row['unidades'];
$this->volumen       = sprintf("%0.6f",$row['volumen']);
$this->otros         = $row['otros'];
$this->fc_concepto   = $row['fc_concepto'];
$this->concepto      = $row['concepto'];

$this->fecha_retira  = '';
if ( strlen($row['fecha_retira']) > 0 ) {
   $this->fecha_retira  = date("d-m-Y",strtotime($row['fecha_retira']));
}
$this->fecha_certifica  = '';
if ( strlen($row['fecha_certifica']) > 0 ) {
   $this->fecha_certifica  = date("d-m-Y",strtotime($row['fecha_certifica']));
}
odbc_free_result($resultado);

return;
}

function r_insert_orcabe()
{
$this->error     = 0;
$this->msg_error = "";

$this->fecha  = date("Ymd",strtotime($this->fecha));

$p_sql="insert into orcabe values ( '{$this->empresa}','{$this->tdoc}' ,'{$this->letra}','{$this->sucur}','{$this->numero}',
                                  '{$this->fecha}','{$this->codigo_cliente}',
                                  '{$this->bultos}','{$this->unidades}','{$this->volumen}','{$this->otros}',
                                  '{$this->fc_concepto}','{$this->estado}','{$this->nro_track}','{$this->concepto}',
                                  '{$this->fecha_retira}','{$this->fecha_certifica}')";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
  $this->error     = 1;
  $this->msg_error = "07- Error. No se pudo insertar [orcabe] !! ";
  return;
}
if (odbc_num_rows($resultado) != 1){
  $this->error     = 1;
  $this->msg_error = "08- Error. No se pudo insertar [orcabe]";
  return;  
}
odbc_free_result($resultado);

return;
}

function r_insert_ordeta()
{
$this->error     = 0;
$this->msg_error = "";
$this->d_id      = r_numeracion(99,'XX','ORDETA');
if ($this->d_id == 0){
   $this->error     = 1;
   $this->msg_error = "09- Error. No se pudo leer nro paquete !! ";
   return;
}
$p_sql="insert into ordeta values ( '{$this->empresa}','{$this->tdoc}' ,'{$this->letra}','{$this->sucur}','{$this->numero}',
                                  '{$this->d_articulo}' ,'{$this->d_bultos}','{$this->d_unidades}','{$this->d_volumen}',
                                  '{$this->d_otros}', '{$this->estado}','{$this->d_id}','{$this->d_estado_lectura}' )" ;
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
  $this->error     = 1;
  $this->msg_error = "10- Error. No se pudo insertar [ordeta] !! ";
  return;
}
if (odbc_num_rows($resultado) != 1){
  $this->error     = 1;
  $this->msg_error = "11- Error. No se pudo insertar [ordeta] !! ";
  return;  
}
odbc_free_result($resultado);

return;
}

function r_update_orcabe()
{
$this->error     = 0;
$this->msg_error = "";

$this->fecha = date("Ymd",strtotime($this->fecha));
$p_vol = sprintf("%0.6f",$this->volumen);
$p_otr = sprintf("%0.6f",$this->otros);

$p_sql="update orcabe set codigo_cliente = '{$this->codigo_cliente}',
                        concepto       = '{$this->concepto}',
                        fecha          = '{$this->fecha}',
                        bultos         = '{$this->bultos}',
                        unidades       = '{$this->unidades}',
                        volumen        = '$p_vol',
                        otros          = '$p_otr',
                        estado         = '{$this->estado}',
                        nro_track      = '{$this->nro_track}'
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
  $this->error     = 1;
  $this->msg_error = "12- Error. No se pudo actualizar [orcabe] !! ";
  return;
}
if (odbc_num_rows($resultado) != 1){
  $this->error     = 1;
  $this->msg_error = "14- Error. No se pudo actualizar [orcabe] !!";
  return;  
}
odbc_free_result($resultado);

return;
}

function r_update_orcabe_cantidad()
{
$this->error     = 0;
$this->msg_error = "";

$p_sql="update orcabe set bultos         = bultos   + '{$this->bultos}',
                        unidades       = unidades + '{$this->unidades}',
                        volumen        = volumen  + '{$this->volumen}',
                        otros          = otros    + '{$this->otros}'
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "15- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
if (odbc_num_rows($resultado) != 1){
   $this->error     = 1;
   $this->msg_error = "16- Error. No se pudo actualizar [orcabe] !!";
   return;
}
odbc_free_result($resultado);

return;
}

function r_update_ordeta()
{
$this->error = 0;
$this->msg_error = '';

$p_sql="update ordeta set estado = '{$this->d_estado}',
                        estado_lectura = '{$this->d_estado_lectura}'
       where empresa = '{$this->empresa}'
         and tdoc    = '{$this->tdoc}'
         and letra   = '{$this->letra}'
         and sucur   = '{$this->sucur}'
         and numero  = '{$this->numero}' ";
if ($this->d_id != 0){
   $p_sql.=" and id  = '{$this->d_id}' ";
}
$this->r_exec($p_sql,"ordeta",0);
if ($this->error != 0){
   $this->error = 2;
   $this->msg_error = '17- Error. No se pudo leer [ordeta] !! ';
   return;
}

return;

}

function r_delete_orcabe()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="delete from orcabe 
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "19- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
if (odbc_num_rows($resultado) <= 0){
   $this->error     = 1;
   $this->msg_error = "20- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
odbc_free_result($resultado);

}

function r_delete_ordeta()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="delete from ordeta 
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
  $this->error     = 1;
  $this->msg_error = "21- Error. No se pudo actualizar [ordeta] !!";
  return;
}
if (odbc_num_rows($resultado) <= 0){
  $this->error     = 1;
  $this->msg_error = "22- Error. No se pudo actualizar [ordeta] !!";
  return;  
}
odbc_free_result($resultado);

}

function r_select_clientes_emp()
{
$this->error     = 0;
$this->msg_error = "";

$p_sql="select * from clientes_emp
       where empresa = '{$this->empresa}'
         and codigo = '{$this->codigo_cliente}'";
$resultado = @odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 2;
   $this->msg_error = "23- Error. No se pudo leer [clientes_emp] !!";
   return;
}
$row=odbc_fetch_array($resultado);
if (!$row) {
   $this->error     = 1;
   $this->msg_error = "24- Error. No se pudo leer [clientes_emp] !!";
   return;
}
$this->cod_dest   = $row['cod_dest'];
$this->cliente    = trim( (string)$row['raz_soc']);
$this->direccion  = trim( (string)$row['direccion']);
$this->pais       = $row['pais'];
$this->provincia  = $row['provincia'];
$this->localidad  = $row['localidad'];
$this->cod_postal = trim( (string)$row['cod_post']);
$this->cuit       = $row['cuit'];
$this->mail       = trim( (string)$row['email']);
$this->tel        = trim( (string)$row['tel']);
return;

}

function r_veo_cpbt_en_hr()
{
$this->error     = 0;
$this->msg_error = '';

$p_hr = 0;
$p_sql="select hruta_d  from hoja_ruta_det
       where empresa = '{$this->empresa}'
         and tdoc   = '{$this->tdoc}'
         and letra  = '{$this->letra}'
         and sucur  = '{$this->sucur}'
         and numero = '{$this->numero}'
         and estado_rm <> 'N'";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error     = 2;
   $this->msg_error = "25- Error. No se pudo leer [hoja_ruta_det] !! ";
   return $p_hr;
}
$row=odbc_fetch_array($resultado);
if ($row){
   $p_hr = $row['hruta_d'];
}
return $p_hr;

}

function r_select_total_ordeta()
{
$this->error = 0;
$this->msg_error = '';
$p_sql="select sum(bultos) bultos,sum(unidades) unidades,sum(volumen) volumen,sum(otros) otros
        from ordeta
       where empresa = '{$this->empresa}'
         and tdoc    = '{$this->tdoc}'
         and letra   = '{$this->letra}'
         and sucur   = '{$this->sucur}'
         and numero  = '{$this->numero}' 
         and estado != 99 ";
$this->r_select_fila($p_sql,"ordeta");
if ($this->error != 0 ){
   $this->error = 2;
   $this->msg_error = '26- Error. No se pudo leer [pddeta] !! ';
   return;
}
if (strlen($this->row['bultos']) > 0 ){
   $this->d_bultos   = $this->row['bultos'];
   $this->d_unidades = $this->row['unidades'];
   $this->d_volumen  = $this->row['volumen'];
   $this->d_otros    = $this->row['otros'];
}
return;
}

// Base garganweb
function r_select_orcabe_w()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="select * from {$this->base_web}or_cab     
 where empresa  = '{$this->empresa}'
   and tdoc     = '{$this->tdoc}'
   and letra    = '{$this->letra}'
   and sucur    = '{$this->sucur}'
   and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error     = 2;
   $this->msg_error = "27- Error. No se pudo leer [orcabe] !! ";
   return;
}
$row=odbc_fetch_array($resultado);
if (!$row){
   $this->error     = 1;
   $this->msg_error = "28- Error. No se pudo leer [orcabe] !!";
   return;
}
$this->codigo_cliente = $row['codigo_cliente'];
$this->fecha          = date("d-m-Y",strtotime($row['fecha']));
$this->estado        = $row['estado'];
$this->bultos        = $row['bultos'];
$this->unidades      = $row['unidades'];
$this->volumen       = sprintf("%0.6f",$row['volumen']);
$this->otros         = $row['otros'];
$this->fc_concepto   = $row['fc_concepto'];
$this->nro_track     = $row['nro_track'];
$this->concepto      = $row['concepto'];

$this->fecha_retira  = '';
if ( strlen($row['fecha_retira']) > 0 ) {
   $this->fecha_retira  = date("d-m-Y",strtotime($row['fecha_retira']));
}
$this->fecha_certifica  = '';
if ( strlen($row['fecha_certifica']) > 0 ) {
   $this->fecha_certifica  = date("d-m-Y",strtotime($row['fecha_certifica']));
}
odbc_free_result($resultado);

return;
}

function r_insert_orcabe_w()
{
$this->error     = 0;
$this->msg_error = "";

$this->fecha  = date("Ymd",strtotime($this->fecha));
if (date("Y",strtotime($this->fecha_retira)) > 1969 ){
    $this->fecha_retira     = date("Ymd",strtotime($this->fecha_retira));
}
else{
    $this->fecha_retira     = '';
}
if (date("Y",strtotime($this->fecha_certifica)) > 1969 ){
    $this->fecha_certifica  = date("Ymd",strtotime($this->fecha_certifica));
}
else{
    $this->fecha_certifica = '';
}

$p_sql_o="insert into {$this->base_web}or_cab values ( '{$this->empresa}','{$this->tdoc}' ,'{$this->letra}','{$this->sucur}','{$this->numero}',
                                                   '{$this->fecha}','{$this->codigo_cliente}',
                                                   '{$this->bultos}','{$this->unidades}','{$this->volumen}','{$this->otros}',
                                                   '{$this->fc_concepto}','{$this->estado}','{$this->nro_track}','{$this->concepto}',
                                                   '{$this->fecha_retira}','{$this->fecha_certifica}' )";
$resultado=@odbc_exec($this->conexion,$p_sql_o);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "29- Error. No se pudo insertar [orcabe] !! ";
   return;
}
if (odbc_num_rows($resultado) != 1){
   $this->error     = 1;
   $this->msg_error = "30- Error. No se pudo insertar [orcabe] !! ";
   return;
}
odbc_free_result($resultado);

return;
}

function r_insert_ordeta_w()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="insert into {$this->base_web}or_det values ( '{$this->empresa}','{$this->tdoc}' ,'{$this->letra}','{$this->sucur}','{$this->numero}',
                            '{$this->d_articulo}' ,'{$this->d_bultos}','{$this->d_unidades}','{$this->d_volumen}',
                            '{$this->d_otros}', '{$this->estado}',{$this->d_id} )" ;
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "31- Error. No se pudo insertar [ordeta] !! ";
   return;
}
if (odbc_num_rows($resultado) != 1){
   $this->error     = 1;
   $this->msg_error = "32- Error. No se pudo insertar [ordeta] !! ";
   return;
}
odbc_free_result($resultado);

return;
}

function r_delete_orcabe_w()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="delete from {$this->base_web}or_cab 
 where empresa  = '{$this->empresa}'
   and tdoc     = '{$this->tdoc}'
   and letra    = '{$this->letra}'
   and sucur    = '{$this->sucur}'
   and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "33- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
if (odbc_num_rows($resultado) <= 0){
   $this->error     = 1;
   $this->msg_error = "34- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
odbc_free_result($resultado);

}

function r_delete_ordeta_w()
{
$this->error     = 0;
$this->msg_error = "";
$p_sql="delete from {$this->base_web}or_det 
       where empresa  = '{$this->empresa}'
         and tdoc     = '{$this->tdoc}'
         and letra    = '{$this->letra}'
         and sucur    = '{$this->sucur}'
         and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "35- Error. No se pudo actualizar [ordeta] !!";
   return;
}
if (odbc_num_rows($resultado) <= 0){
   $this->error     = 1;
   $this->msg_error = "36- Error. No se pudo actualizar [ordeta] !!";
   return;
}
odbc_free_result($resultado);

}

function r_update_orcabe_w()
{
$this->error     = 0;
$this->msg_error = "";

$this->fecha = date("Ymd",strtotime($this->fecha));
$p_vol = sprintf("%0.6f",$this->volumen);
$p_otr = sprintf("%0.6f",$this->otros);

$p_sql="update {$this->base_web}or_cab set codigo_cliente = '{$this->codigo_cliente}',
                                         concepto       = '{$this->concepto}',
                                         fecha          = '{$this->fecha}',
                                         bultos         = '{$this->bultos}',
                                         unidades       = '{$this->unidades}',
                                         volumen        = '$p_vol',
                                         otros          = '$p_otr',
                                         estado         = '{$this->estado}',
                                         nro_track      = '{$this->nro_track}'
 where empresa  = '{$this->empresa}'
   and tdoc     = '{$this->tdoc}'
   and letra    = '{$this->letra}'
   and sucur    = '{$this->sucur}'
   and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
   $this->error     = 1;
   $this->msg_error = "37- Error. No se pudo actualizar [orcabe] !! ";
   return;
}
if (odbc_num_rows($resultado) != 1){
   $this->error     = 1;
   $this->msg_error = "38- Error. No se pudo actualizar [orcabe] !!";
   return;
}
odbc_free_result($resultado);

return;
}

function r_update_orcabe_w_nro_track()
{
$this->error     = 0;
$this->msg_error = "";

$p_sql="update {$this->base_web}or_cab set nro_track      = '{$this->nro_track}'
         where empresa  = '{$this->empresa}'
           and tdoc     = '{$this->tdoc}'
           and letra    = '{$this->letra}'
           and sucur    = '{$this->sucur}'
           and numero   = '{$this->numero}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado) {
    $this->error     = 1;
    $this->msg_error = "39- Error. No se pudo actualizar [or_cab] !! ";
    return;
}
if (odbc_num_rows($resultado) != 1){
    $this->error     = 1;
    $this->msg_error = "40- Error. No se pudo actualizar [or_cab] !!";
    return;
}
odbc_free_result($resultado);

return;
}

function r_update_ordeta_w()
{
$this->error = 0;
$this->msg_error = '';

$p_sql="update {$this->base_web}or_det set bultos   =  bultos + '{$this->d_bultos}',
                                         unidades = unidades + '{$this->d_unidades}',
                                         volumen  = volumen + '{$this->d_volumen}',
                                         otros    = otros + '{$this->d_otros}'
where empresa = '{$this->empresa}'
  and tdoc    = '{$this->tdoc}'
  and letra   = '{$this->letra}'
  and sucur   = '{$this->sucur}'
  and numero  = '{$this->numero}' 
  and articulo = '{$this->d_articulo}' ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error = 2;
   $this->msg_error = '41- Error. No se pudo leer [ordeta] !! ';
   return;
}
if (odbc_num_rows($resultado) <= 0){
   $this->error = 1;
   $this->msg_error = '42- Error. No se pudo leer [ordeta] !! ';
   return;
}

return;

}

function r_update_ordeta_w_estado()
{
$this->error = 0;
$this->msg_error = '';

$p_sql="update {$this->base_web}or_det set estado   =  '{$this->d_estado}'
        where empresa = '{$this->empresa}'
          and tdoc    = '{$this->tdoc}'
          and letra   = '{$this->letra}'
          and sucur   = '{$this->sucur}'
          and numero  = '{$this->numero}'
          and estado != 99 ";
$resultado=@odbc_exec($this->conexion,$p_sql);
if (!$resultado){
   $this->error = 2;
   $this->msg_error = '43- Error. No se pudo leer [ordeta] !! ';
   return;
}

return;

}

function __destruct()
{
//odbc_close($this->conexion);
}
}
?>