<?php
session_start();	
//-------------------------	
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
$_CM=V($_GET['C']);
$_P1=V($_GET['P1']);
header('Content-Type: text/html; charset=utf-8');
if($_CM=="C"){
	$IA=$_P1;
	$ID=gn("MAX(id)","sunat","id_almacen=$IA");
	if($ID>0){
		//
		$RU=gs("ru","sunat","id=$ID");
		$CL=gs("cli","sunat","id=$ID");
		$DI=gs("di","sunat","id=$ID");
		//
		$StrDIV=GenTxt("RUC_TXT",$RU).GenTxt("CLI_TXT",$CL).GenTxt("DIR_TXT",$DI);
		//
		echo utf8_encode($StrDIV);
	}else{
		echo "";
	}
}
if($_CM=="V"){
	$IA=gn("id_almacen","almacenes","alm_nombre='$_P1'");
	$ID=gn("MAX(id)","sunat","id_almacen=$IA");
	if($ID>0){
		//
		$RU=gs("ru","sunat","id=$ID");
		$CL=gs("cli","sunat","id=$ID");
		$DI=gs("di","sunat","id=$ID");
		//
		$StrDIV=GenTxt("RUC_TXT",$RU).GenTxt("CLI_TXT",$CL).GenTxt("DIR_TXT",$DI);
		//
		echo utf8_encode($StrDIV);
	}else{
		echo "";
	}
}
?>