// $expe->regRefCltePers($_POST['txtNombreReferencia'.$i],
    //  $m, $_POST['txtTelefonoReferencia'.$i], '', "", $_POST['txtRelacion'.$i]);
    $i++;
}
//referencias comerciales
$i = 1;
while ($i <= $_POST['numbRefComrs']) {
    $expe->regRefClteCom($_POST['txtComercio' . $i], $_POST['txtReferenciaComercial' . $i], $m, $_POST['cmbTipoRef' . $i]);
    $i++;
}
//adjuntos
//identificacion oficial
if (!empty($_FILES['identificacionOficial']['name'])) {
    $name_file = $upo->guardarArchivo('identificacionOficial', $m);
    // $expe->regAdjuntoExpend($_FILES['identificacionOficial']['name'], $m, $_POST['tipoDocIden']);
    $expe->regAdjuntoExpend($name_file, $m, $_POST['tipoDocIden']);
} else {
    $expe->regAdjuntoExpend("sin adjunto", $m, $_POST['tipoDocIden']);
}
//comprobante de domicilio
if (!empty($_FILES['comprobanteDom']['name'])) {
    $name_file = $upo->guardarArchivo('comprobanteDom', $m);
    // $expe->regAdjuntoDom($dom, $_FILES['comprobanteDom']['name'], $_POST['tipoDocDom']);
    $expe->regAdjuntoDom($dom, $name_file, $_POST['tipoDocDom']);
} else {
    $expe->regAdjuntoDom($dom, "sin adjunto", $_POST['tipoDocDom']);
}
//fotografia
if (!empty($_FILES['foto']['name'])) {
    $name_file = $upo->guardarArchivo('foto', $m);
    // $expe->regAdjuntoExpend($_FILES['foto']['name'], $m, 20);
$exped = new cExpediente();
if (isset($_POST['obligado'])) {
    $m = $exped->regExpedienteClteObligado('', $_POST['txtApellidoPaterno'], $_POST['txtApellidoMaterno'], $_POST['txtNombre'], $_POST['txtFechaNacimiento'], $_POST['tipoExp'], $_POST['compartir'], $_POST['prestarsinob'], 1, $_POST['ciudadnac'], $_POST['txtEstadoNac'], $_POST['txtTelefono'], $_POST['txtCorreo'], $_POST['txtCURP'], $_POST['txtRFC'], $_POST['txtNacionalidad'], $_POST['generoQ'], $_POST['giro'], $_POST['txtObservaciones'], $_POST['id_persona2']);
} else {
    $m = $exped->regNvoExp('', $_POST['txtApellidoPaterno'], $_POST['txtApellidoMaterno'], $_POST['txtNombre'], $_POST['txtFechaNacimiento'], $_POST['tipoExp'], $_POST['compartir'], $_POST['prestarsinob'], 1, $_POST['ciudadnac'], $_POST['txtEstadoNac'], $_POST['txtTelefono'], $_POST['txtCorreo'], $_POST['txtCURP'], $_POST['txtRFC'], $_POST['txtNacionalidad'], $_POST['generoQ'], $_POST['giro'], $_POST['txtObservaciones'], $_POST['id_persona2']);
}
$exped->creaPerfilTrans($m, $_POST['ingreso'], $_POST['origen_recursos'], $_POST['giro'], $_POST['destino_recursos'], $_POST['montooperaciones'], $_POST['numoperaciones']);
$iddom = $exped->regDomClte($m, $_POST['txtCalle'], $_POST['txtAvenida'], $_POST['txtNumeroEx'], $_POST['txtNumeroIn'], $_POST['txtColonia'], $_POST['txtCodigoPostal'], $_POST['txtCiudad'], $_POST['txtEstado'], '', 1, $_POST['txtDelegacion'], $_POST['txtPais'], 'no def', 'no def', $_POST['referenciaDom'], '', '', 1);
$exped->regDetallesExpe($m, $_POST['txtOcupacion'], $_POST['origen_recursos'], $_POST['destino_recursos'], 0, 1, '', '', '00:00', '', '', '', '');
$exped->regEmpleoClte($m, '', '', '', '', '', '', '', '', $_POST['ingreso'], '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
echo "EXPEDIENTE REGISTRADO CON ÉXITO";
//registra los adjuntos
//identificacion oficial
if (!empty($_FILES['identificacionOficial']['name'])) {
    $upo->guardarArchivo('identificacionOficial', $m);
    $exped->regAdjuntoExpend($_FILES['identificacionOficial']['name'], $m, $_POST['tipoDocIden']);
} else {
    $exped->regAdjuntoExpend("sin adjunto", $m, $_POST['tipoDocIden']);
}
//comprobante de domicilio
if (!empty($_FILES['comprobanteDom']['name'])) {
    $upo->guardarArchivo('comprobanteDom', $m);
    $exped->regAdjuntoDom($iddom, $_FILES['comprobanteDom']['name'], $_POST['tipoDocDom']);
} else {
    $exped->regAdjuntoDom($iddom, "sin adjunto", $_POST['tipoDocDom']);
}
//referencias bancarias
if (!empty($_FILES['refBancaria1']['name'])) {
    $upo->guardarArchivo('refBancaria1', $m);
    $exped->regAdjuntoExpend($_FILES['refBancaria1']['name'], $m, 15);
} else {
        $exped->regAdjuntosRepPMS($_FILES['adjPoderRepr' . $i]['name'], $repre, 39);
    } else {
        $exped->regAdjuntosRepPMS('sin adjunto', $repre, 39);
    }
}
//registra adjunto de domicilio
if (!empty($_SESSION['comproDom']['name'])) {
    $adjuntos->guardarArchivo("comproDom", $m);
    $exped->regAdjuntoDom($dom, $_SESSION['tipoDocIden']['name'], $_POST['tipoDocIden']);
} else {
    $exped->regAdjuntoDom($dom, "sin adjunto", $_POST['tipoDocIden']);
}
//registra los poderes notariales (usando el input de evaluacion)
if (!empty($_FILES['evaluacion']['name'])) {
    $adjuntos->guardarArchivo('evaluacion', $m);
    $exped->regAdjuntoExpend($_FILES['evaluacion']['name'], $m, 8);
} else {
    $exped->regAdjuntoExpend('sin adjunto', $m, 8);
}
//comprobante notarial
if (!empty($_FILES['comprobanteNotarial']['name'])) {
    $adjuntos->guardarArchivo('comprobanteNotarial', $m);
    $exped->regAdjuntoExpend($_FILES['evaluacion']['name'], $m, 39);
} else {
    $exped->regAdjuntoExpend('sin adjunto', $m, 39);
}
//cconstancia de la fiel
if (!empty($_FILES['comprobanteFiel']['name'])) {
    $adjuntos->guardarArchivo('comprobanteFiel', $m);
    $exped->regAdjuntoExpend($_FILES['comprobanteFiel']['name'], $m, 18);
} else {