drsaimon
Mensagens : 5 Data de inscrição : 17/11/2010 Idade : 34 Localização : Porto Alegre
| Assunto: Erro ao inserir dados no modulo inventario Seg Dez 13, 2010 3:30 pm | |
| Buenas a todos no modulo inventario/cadastrar/equipamento eu fiz algumas alterações Mais ao inserir um equipamento ele retorna um erro. Eu alterei os arquivos, incluir_computador.php, e adcionei novas colunas no mysql, no mysql tenho certeza de que não é. Pra quem quiser olhar ai vai o codigo fonte(a parte que importa) ele ta comentado não tem erro: - Código:
-
print "<BR>"; print "<B>".TRANS('TTL_CAD_EQUIP_SYSTEM').":"; print "<BR>";
print "<FORM name='form1' method='POST' action='".$_SERVER['PHP_SELF']."' ENCTYPE='multipart/form-data' onSubmit='return valida()'>";
print "<TABLE border='0' colspace='3' width='100%'>";
print "<tr><td colspan='4'></td><b>".TRANS('SUBTTL_INFO_GENERAL').":</b></td></tr>"; print "<tr>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_EQUIP')."'>".TRANS('FIELD_TYPE_EQUIP').":</a></b>". "</TD>"; /*equipamento*/ print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_tipo_equip' id='idTipo' size='1' ". "onChange="fillSelectFromArray(this.form.comp_marca, ((this.selectedIndex == -1) ? null : ". "team[this.selectedIndex-1]));">";
print "<option value=-1 selected>".TRANS('SEL_TYPE_EQUIP')."</option>";
$query = "SELECT * from tipo_equip order by tipo_nome"; $resultado = mysql_query($query); while ($rowTipo = mysql_fetch_array($resultado)) { print "<option value='".$rowTipo['tipo_cod']."' "; if (isset($queryA) && $rowTipo['tipo_cod'] == $row['equipamento_cod']) print " selected"; print ">".$rowTipo['tipo_nome']."</option>"; } print "</SELECT>"; print "</TD>"; /*Fabricante*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_MANUF')."'>".TRANS('COL_MANUFACTURE').":*</a></b>". "</TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_fab' size='1' id='idFab'>";
print "<option value=-1>".TRANS('SEL_MANUFACTURE').": </option>"; $query = "SELECT * from fabricantes order by fab_nome"; $resultado = mysql_query($query); while ($rowFab = mysql_fetch_array($resultado)) { print "<option value='".$rowFab['fab_cod']."' "; if (isset($queryA) && $rowFab['fab_cod'] == $row['fab_cod']) print " selected "; print ">".$rowFab['fab_nome']."</option>"; } print "</SELECT>"; print "</TD>"; print "</tr>";
/* Etiqueta (SERVICE TAG) foi alterado no SQL de int para Varchar*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>"."<a title='".TRANS('MSG_REQUER_FIELD_TAG_EQUIP')."'>". "".TRANS('FIELD_TAG')."*:</a></b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_inv' ". " id='idEtiqueta'></TD>"; ############################# ############################# /*Patrimonio foi adcionado no SQL o campo comp_patri*/ ######################### print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('COL_PATRI')."*: </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_patri'></TD>"; print "</TR>"; ################################# ######################## /*Codigo -CPU foi adcionado no SQl a campo comp__cod_cpu */ ################################## print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_COD_CPU')."*: </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_codcpu'></TD>"; /* Numero de serie */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('COL_SN')."*: </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_sn'></TD>"; print "</TR>"; /*modelo equipamento*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_EQUIP_CAD')."'>".TRANS('COL_MODEL')."*:</a></b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_marca' size='1' id='idModelo' >";
print "<option value=-1 selected>".TRANS('SEL_MODEL')."</option>";
$query = "SELECT * from marcas_comp order by marc_nome"; $resultado = mysql_query($query); while ($rowMarcas= mysql_fetch_array($resultado)) { print "<option value='".$rowMarcas['marc_cod']."'"; if ((isset($_POST['comp_marca']) && ($rowMarcas['marc_cod'] == $_POST['comp_marca'])) || (isset ($_GET['LOAD']) && $_GET['LOAD'] == $rowMarcas['marc_cod']) )
print " selected"; print ">".$rowMarcas['marc_nome']."</option>"; }
print "</select>"; print "<input type='button' name='modelo' value='".TRANS('NEW')."' class='minibutton' onClick="javascript:popup_alerta('modelos.php?popup=true')">"; print "</td>"; /* Local */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_EQUIP_LOCAL')."'>". "".TRANS('COL_LOCAL')."*:</a></b></TD>"; print "<TD width='30%' align='left' valign='top' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_local' size='1' id='idLocal'>"; print "<option value=-1 selected>".TRANS('OCO_SEL_LOCAL')."</option>";
$query = "SELECT * from localizacao order by local"; $resultado = mysql_query($query); while ($rowLocal = mysql_fetch_array($resultado)) { print "<option value='".$rowLocal['loc_id']."'>".$rowLocal['local']."</option>"; } print "</SELECT>"; print "</TD>"; print "</tr>"; /*Carregar configuração*/ print "<tr>"; print "<td colspan='2' width='20%' align='left'><input type='button' class='button' value='".TRANS('BT_LOAD_CONFIG')."' name='ok2' ". "onClick="redirectLoad('".$_SERVER['PHP_SELF']."?LOAD=','idModelo');" ". "title='".TRANS('MSG_LOAD_HW_MODEL_SEL')."'>". /*cadastrar configuração*/ "<input type='button' class='button' name='configuracao' value='".TRANS('BT_CAD_CONFIG')."' ". "onClick="redirect('incluir_molde.php')"></td> <td colspan='2' width='80'>". "</td>"; print "</tr>"; /* situação do equipamento*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_SIT_EQUIP')."'>".TRANS('COL_SITUAC')."*:</a></b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_situac' size='1' id='idSituac'>"; print "<option value=-1 selected>".TRANS('SEL_SITUAC')."</option>"; $query = "SELECT * from situacao order by situac_nome"; $resultado = mysql_query($query); while ($rowSituac = mysql_fetch_array($resultado)) { print "<option value='".$rowSituac['situac_cod']."'>".$rowSituac['situac_nome']."</option>"; } print "</select>"; print "</td>"; /*anexar imagem*/ print "<td width='20%' bgcolor='".TD_COLOR."'><b>".TRANS('OCO_FIELD_ATTACH_IMG')."</b></td>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='file' class='text' name='img' id='idImg'></TD>"; print "</tr>"; /* informações do computador*/ print "<TR><td colspan='4'></td></TR>"; print "<tr><td colspan='3'><b>".TRANS('SUBTTL_INFO_CONFIG_EQUIP').":</b></td><td class='line'>". "<input type='button' class='button' value='".TRANS('TTL_INCLUDE_COMP')."' ". "Onclick="return popup_alerta('itens.php?action=incluir&cellStyle=true&popup=true')"></td>". "</tr>"; /* nome do computador*/ print "<TR><td colspan='4'></td></TR>";
print "<tr>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_NAME_COMPUTER').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_nome' maxlength='15'></TD>"; ####NOME DO USUÁRIO foi add no SQL comp_user ######### print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_NAME_USER').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_user' maxlength='15'></TD>"; print "</tr>"; ############## CARGO FUNÇÃO foi add no SQL comp_user ############# ######################################### print "<tr>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_CARGO_FUNC').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_cargo' maxlength='15'></TD>"; /* placa mãe*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_MB').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_mb' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 10 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); $sufixo = ""; while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $row['cod_mb'] == $rowA['mdit_cod']) print " selected"; print ">"; print "".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."". "</option>"; } // while
print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; /*processador*/ print "<tr>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_PROC').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_proc' size='1'>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 11 order by mdit_fabricante, mdit_desc, mdit_desc_capacidade"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_processador']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>";
/*memoria*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_MEMO').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_memo' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 7 order by mdit_fabricante, mdit_desc, mdit_desc_capacidade"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_memoria']) print " selected"; print ">".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; //print "<option value='".$rowA['mdit_cod']."'>".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; ########################################################################################## ##### MODIFICAÇÃO dos itens cdrom e dvd para midia optica e tipo momoria ################ /*cd rom */ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_CDROM').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_cdrom' size='1'>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 5 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_cdrom']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; /* tipo memoria */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_TIPO_MEMO').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_memot' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 7 order by mdit_fabricante, mdit_desc, mdit_desc_capacidade"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_memoria']) print " selected"; print ">".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; //print "<option value='".$rowA['mdit_cod']."'>".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; ########################################################################################################## ########################################################################################################## ##################### RETIRADO DA VERÇÃO BETA ########################## ########################################################################################### #################################################################### /*placa video print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_VIDEO').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_video' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 2 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_video']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; /*placa de som print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_SOM').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_som' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 4 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_som']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; ################################ /* placa de rede */ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_REDE').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_rede' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 3 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_rede']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; /*placa fax modem(TIPO DE REDE) */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_MODEM').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_modem' size=1>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 6 order by mdit_fabricante, mdit_desc"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_modem']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; /*(HDD SIZE) */ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_HD').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_hdsize' size='1'>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 1 order by mdit_fabricante, mdit_desc_capacidade"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_hd']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; /* (HDD) */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('MNL_TIPO_HD').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_modelohd' size='1'>";
print "<option value=null selected>".TRANS('SEL_MODEL')."</option>";
$query = "select * from modelos_itens where mdit_tipo = 1 order by mdit_fabricante, mdit_desc_capacidade"; $commit = mysql_query($query); while($rowA = mysql_fetch_array($commit)){ print "<option value='".$rowA['mdit_cod']."' "; if (isset($queryA) && $rowA['mdit_cod'] == $row['cod_hd']) print " selected"; print ">".$rowA['mdit_fabricante']." ".$rowA['mdit_desc']." ".$rowA['mdit_desc_capacidade']."".$rowA['mdit_sufixo']."</option>"; } // while print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</TR>"; /*INFORMAÇÕES PARA INTENS ESPCIFICOS*/ print "<TR><td colspan='4'></td></TR>"; print "<tr><td colspan='4'><b>".TRANS('SUBTTL_INFO_ITEM_ESPEC').":</b></td></tr>"; print "<TR><td colspan='4'></td></TR>"; /*TIPO DE IMPRESSORA*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_TYPE_PRINTER').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_tipo_imp' size=1>";
print "<option value=null selected>".TRANS('SEL_TYPE_PRINTER')." </option>";
$query = "SELECT * from tipo_imp order by tipo_imp_nome"; $resultado = mysql_query($query); while ($rowImp = mysql_fetch_array($resultado)) { print "<option value='".$rowImp['tipo_imp_cod']."' "; if (isset($queryA) && $rowImp['tipo_imp_cod'] == $row['impressora_cod']) print " selected"; print ">".$rowImp['tipo_imp_nome']."</option>"; } print "<option value=null>".TRANS('SEL_SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; /*TIPO DE MONITOR*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_MONITOR').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_polegada' size=1>";
print "<option value =null selected>".TRANS('SEL_SIZE_MONITOR')." </option>";
$query = "SELECT * from polegada order by pole_nome"; $resultado = mysql_query($query); while ($rowPol = mysql_fetch_array($resultado)) { print "<option value='".$rowPol['pole_cod']."' "; if (isset($queryA) && $rowPol['pole_cod'] == $row['polegada_cod']) print " selected"; print ">".$rowPol['pole_nome']."</option>"; } print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>";
print "<tr>"; /*TIPO DE SCANNER*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_SCANNER').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_resolucao' size=1>";
print "<option value=null selected>".TRANS('SEL_RESOLUT_SCANNER')." </option>";
$query = "SELECT * from resolucao order by resol_nome"; $resultado = mysql_query($query); while ($rowResol = mysql_fetch_array($resultado)) { print "<option value='".$rowResol['resol_cod']."' "; if (isset($queryA) && $rowResol['resol_cod'] == $row['resolucao_cod']) print " selected"; print ">".$rowResol['resol_nome']."</option>"; } print "<option value=null>".TRANS('SEL_NONE')."</option>"; print "</SELECT>"; print "</TD>"; ################################################## ############################################## ############################################## /* MARCA MONITOR */ #################################################### ######################################################### ############################################## print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_MANUF')."'>".TRANS('FIELD_MAC_MONITOR').":*</a></b>". "</TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_fabm' size='1' >";
print "<option value=-1>".TRANS('SEL_MANUFACTURE').": </option>"; $query = "SELECT * from fabricantes order by fab_nome"; $resultado = mysql_query($query); while ($rowFab = mysql_fetch_array($resultado)) { print "<option value='".$rowFab['fab_cod']."' "; if (isset($queryA) && $rowFab['fab_cod'] == $row['fab_cod']) print " selected "; print ">".$rowFab['fab_nome']."</option>"; } print "</SELECT>"; print "</TD>";
print "</tr>";
/* INFORMAÇÕES CONTABEIS*/ print "<TR><td colspan='4'></td></TR>"; print "<tr><td colspan='4'><b> ".TRANS('SUBTTL_INFO_COUNT').":</b></td></tr>"; print "<TR><td colspan='4'></td></TR>"; /*UNIDADE*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>". "<a title='".TRANS('MSG_REQUER_FIELD_SEL_UNIT_PROP')."'>".TRANS('OCO_FIELD_UNIT')."*:</a>"." </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_inst' size='1' id='idUnidade'>"; print "<option value=null selected>".TRANS('OCO_SEL_UNIT')." </option>";
$query = "SELECT * from instituicao order by inst_nome"; $resultado = mysql_query($query); while ($rowInst = mysql_fetch_array($resultado)) { print "<option value='".$rowInst['inst_cod']."' "; if (isset($queryA) && $rowInst['inst_cod'] == $row['cod_inst']) print " selected"; print ">".$rowInst['inst_nome']."</option>"; } print "</SELECT>"; print "</TD>"; /*CENTRO DE CUSTO*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_CENTER_COST').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_ccusto' size=1>"; print "<option value =null selected>".TRANS('SEL_CENTER_COST')." </option>";
//$query = "SELECT * from ".`DB_CCUSTO`.".".TB_CCUSTO." order by ".CCUSTO_DESC.""; //where ano='2003' $query = "SELECT * from `".DB_CCUSTO."`.".TB_CCUSTO." order by ".CCUSTO_DESC.""; $resultado = mysql_query($query); while ($rowCcusto = mysql_fetch_array($resultado)) { print "<option value='".$rowCcusto[CCUSTO_ID]."'>".$rowCcusto[CCUSTO_DESC]." - ".$rowCcusto[CCUSTO_COD]."</option>"; } print "</SELECT>"; print "</TD>"; print "</tr>"; /*VENDEDOR*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('COL_VENDOR')."*: </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_fornecedor' size=1>"; print "<option value=null selected>".TRANS('SEL_VENDOR')."</option>";
$query = "SELECT * from fornecedores order by forn_nome"; $resultado = mysql_query($query);
while ($rowForn = mysql_fetch_array($resultado)) { print "<option value='".$rowForn['forn_cod']."' "; if (isset($queryA) && $rowForn['forn_cod'] == $row['fornecedor_cod']) print " selected"; print ">".$rowForn['forn_nome']."</option>"; } print "</SELECT>"; print "</TD>"; /*NOTA FISCAL*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_FISCAL_NOTES')."*:</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_nf'></TD>"; print "</tr>"; /* VALOR DA COMPRA */ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_VALUE')."*:</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_valor' id='idValor'></TD>"; /* DATA DA COMPRA */ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_DATE_PURCHASE')."*:</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'><INPUT type='text' class='text' name='comp_data_compra' id='idDataCompra'></TD>"; print "</tr>"; /*TIPO DE GARANTIA*/ print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_TYPE_GUARAT').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_tipo_garant' size=1>";
//print "<option value=null selected>".TRANS('SEL_TYPE')."</option>";
$query = "SELECT * from tipo_garantia order by tipo_garant_nome"; $resultado = mysql_query($query); while ($rowGarant = mysql_fetch_array($resultado)) { print "<option value='".$rowGarant['tipo_garant_cod']."'>".$rowGarant['tipo_garant_nome']."</option>"; } print "<option value=null selected>".TRANS('SEL_TYPE')."</option>"; print "</SELECT>"; print "</TD>"; /*TEMPO DE GARANTIA*/ print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('FIELD_TIME_GUARANT').": </b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>"; print "<SELECT class='select' name='comp_garant_meses' size=1>"; //print "<option value=null selected>".TRANS('SEL_TIME_GUARANT')."</option>";
$query = "SELECT * from tempo_garantia order by tempo_meses"; $resultado = mysql_query($query); while ($rowTempo = mysql_fetch_array($resultado)) { print "<option value='".$rowTempo['tempo_cod']."'>".$rowTempo['tempo_meses']." ".TRANS('TXT_MOUNTHS')."</option>"; } print "<option value=null selected>".TRANS('SEL_TIME_GUARANT')."</option>"; print "</SELECT>"; print "</TD>"; print "</tr>"; /*COMENTARIOS*/ print "<tr>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b>".TRANS('COL_COMMENT').":</b></TD>"; print "<TD width='30%' colspan='3' align='left' bgcolor='".BODY_COLOR."'>". "<TEXTAREA class='textarea' name='comp_coment'></textarea>".//cols='75' rows='5' "</TD>"; print "</TR>";
print "<TR>"; print "<TD width='20%' align='left' bgcolor='".TD_COLOR."'><b".TRANS('COL_SUBSCRIBE_DATE').":</b></TD>"; print "<TD width='30%' align='left' bgcolor='".BODY_COLOR."'>".datab($hoje)."</TD>"; print "</TR>";
print "<TR>"; print "<TD colspan='2' align='right' bgcolor='".BODY_COLOR."'><input type='submit' value='".TRANS('BT_CAD')."' name='submit' ". "class='button' title='".TRANS('MSG_CAD_INFO_SUPP')."'>"; print "</TD>"; print "<TD colspan='2' align='right' bgcolor='".BODY_COLOR."'><INPUT type='reset' value='".TRANS('BT_CANCEL')."' ". "class='button' onClick="javascript:history.back()"></TD>"; print "</TR>";
print "</TABLE>"; print "</FORM>";
if (isset ($_POST['submit'])) { $erro=false;
$querySN = "SELECT c.* FROM equipamentos as c ". "WHERE c.comp_marca='".$_POST['comp_marca']."' and ". "c.comp_sn='".$_POST['comp_sn']."'"; $resultadoSN = mysql_query($querySN); $linhasSN = mysql_numrows($resultadoSN); if ($linhasSN > 0) { $aviso = TRANS('MSG_SERIAL_NUMBER_CAD_IN_SYSTEM'); $erro = true; }
$query2 = "SELECT c.* FROM equipamentos as c ". "WHERE ((c.comp_inv='".$_POST['comp_inv']."') and ". "(c.comp_inst = '".$_POST['comp_inst']."'))";
$resultado2 = mysql_query($query2); $linhas = mysql_numrows($resultado2); if ($linhas > 0) { $aviso.= TRANS('MSG_COD_TAG_CAD_IN_SYSTEM'); $erro = "sim"; }
$gravaImg = false; if (isset($_FILES['img']) and $_FILES['img']['name']!="") { $qryConf = "SELECT * FROM config"; $execConf = mysql_query($qryConf) or die (TRANS('MSG_ERR_NOT_ACCESS_INFO_CONFIG')); $rowConf = mysql_fetch_array($execConf); $arrayConf = array(); $arrayConf = montaArray($execConf,$rowConf);
$upld = upload('img',$arrayConf); if ($upld =='OK') { $gravaImg = true; } else { $upld.="<br><a align='center' onClick="exibeEscondeImg('idAlerta');'><img src='".ICONS_PATH."/stop.png' width='16px' height='16px'> ".TRANS('LINK_CLOSE')."</a>"; print "</table>"; print "<div class='alerta' id='idAlerta'><table bgcolor='#999999'><tr><td colspan='2' bgcolor='yellow'>".$upld."</td></tr></table></div>"; exit; } }
if (!$erro) {
if ($gravaImg) { //INSERÇÃO DA IMAGEM NO BANCO $fileinput=$_FILES['img']['tmp_name']; $tamanho = getimagesize($fileinput);
if(chop($fileinput)!=""){ // $fileinput should point to a temp file on the server // which contains the uploaded image. so we will prepare // the file for upload with addslashes and form an sql // statement to do the load into the database. $image = addslashes(fread(fopen($fileinput,"r"), 1000000)); $SQL = "Insert Into imagens (img_nome, img_inst, img_inv, img_tipo, img_bin, img_largura, img_altura) values ". "('".$_FILES['img']['name']."', '".$comp_inst."', '".$comp_inv."', '".$_FILES['img']['type']."', '".$image."', ".$tamanho[0].", ".$tamanho[1].")"; // now we can delete the temp file unlink($fileinput); } $exec = mysql_query($SQL); if ($exec == 0) $aviso.= TRANS('MSG_NOT_ATTACH_IMG')."<br>"; } $sql = "INSERT INTO historico (hist_inv, hist_inst, hist_local, hist_data) ". "VALUES ('".$_POST['comp_inv']."', '".$_POST['comp_inst']."', '".$_POST['comp_local']."', '".date("Y-m-d H:i:s")."')"; $resultadoSQL = mysql_query($sql);
//$data = $hoje; $comp_valor = str_replace(",",".",$_POST['comp_valor']);
// $comp_data_compra = datam($_POST['comp_data_compra']); // if ($_POST['comp_sn'] == -1) { $comp_sn = "null";};// else $comp_sn = "$comp_sn"; // if ($_POST['comp_mb'] == -1) { $comp_mb = "null";} else $comp_mb = "'$comp_mb'"; // if ($_POST['comp_proc'] == -1) { $comp_proc = "null";} else $comp_proc = "'$comp_proc'"; // if ($_POST['comp_memo'] == -1) { $comp_memo = "null";} else $comp_memo = "'$comp_memo'"; // if ($_POST['comp_video'] == -1) { $comp_video = "null";} else $comp_video = "'$comp_video'"; // if ($_POST['comp_som'] == -1) { $comp_som = "null";} else $comp_som = "'$comp_som'"; // if ($_POST['comp_rede'] == -1) { $comp_rede = "null";} else $comp_rede = "'$comp_rede'"; // if ($_POST['comp_modelohd'] == -1) { $comp_modelohd = "null";} else $comp_modelohd = "'$comp_modelohd'"; // if ($_POST['comp_modem'] == -1) { $comp_modem = "null";} else $comp_modem = "'$comp_modem'"; // if ($_POST['comp_cdrom'] == -1) { $comp_cdrom = "null";} else $comp_cdrom = "'$comp_cdrom'"; // if ($_POST['comp_dvd'] == -1) { $comp_dvd = "null";} else $comp_dvd = "'$comp_dvd'"; // if ($_POST['comp_grav'] == -1) { $comp_grav = "null";} else $comp_grav = "'$comp_grav'"; // if ($_POST['comp_nome'] == -1) { $comp_nome = "null";} ;//else $comp_nome = "'$comp_nome'"; // if ($_POST['comp_nf'] == -1) { $comp_nf = "null";};// else $comp_nf = "'$comp_nf'"; // if ($_POST['comp_coment'] == -1) { $comp_coment = "null";};// else $comp_coment = "'$comp_coment'"; // if ($_POST['comp_ccusto'] == -1) { $comp_ccusto = "null";} else $comp_ccusto = "'$comp_ccusto'"; // if ($_POST['comp_tipo_imp'] == -1) { $comp_tipo_imp = "null";} else $comp_tipo_imp = "'$comp_tipo_imp'"; // if ($_POST['comp_resolucao'] == -1) { $comp_resolucao = "null";} else $comp_resolucao = "'$comp_resolucao'"; // if ($_POST['comp_polegada'] == -1) { $comp_polegada = "null";} else $comp_polegada = "'$comp_polegada'"; // if ($_POST['comp_fornecedor'] == -1) { $comp_fornecedor = "null";} else $comp_fornecedor = "'$comp_fornecedor'"; // // if ($_POST['comp_tipo_garant'] == -1) { $comp_tipo_garant = "null";} else $comp_tipo_garant = "'$comp_tipo_garant'"; // if ($_POST['comp_garant_meses'] == -1) { $comp_garant_meses = "null";} else $comp_garant_meses = "'$comp_garant_meses'";
#### INSERIR DADOS NO BANCO ##### /* retirado comp_video e comp_som, comp_dvd, comp_grav, , */ $query = "INSERT INTO equipamentos ". "(comp_inv, comp_sn, comp_marca, comp_mb, comp_proc, comp_memo, ". /* linha inserida==> */ "comp_codcpu, comp_patri, comp_memot, comp_hdsize, comp_user, comp_cargo, comp_fabm, ". "comp_rede, comp_modelohd, comp_modem, comp_cdrom, comp_nome, ". "comp_local, comp_fornecedor, comp_nf, comp_coment, comp_data, comp_valor, comp_data_compra, ". "comp_inst, comp_ccusto, comp_tipo_equip, comp_tipo_imp, comp_resolucao, comp_polegada, ". "comp_fab, comp_situac, comp_tipo_garant, comp_garant_meses) ". "VALUES ('".$_POST['comp_inv']."','".noHtml($_POST['comp_sn'])."','".$_POST['comp_marca']."',". "".$_POST['comp_mb'].", ".$_POST['comp_proc'].",".$_POST['comp_memo'].",". /* linha inserida==> */ "".$_POST['comp_codcpu'].", ".$_POST['comp_patri'].",".$_POST['comp_memot'].",".$_POST['comp_hdsize'].",". /* linha inserida==> */ "".$_POST['comp_user'].",".$_POST['comp_cargo'].",".$_POST['comp_fabm'].".". "".$_POST['comp_tipo_rede'].", ".$_POST['comp_rede'].", ".$_POST['comp_modelohd'].", ". "".$_POST['comp_modem'].", ".$_POST['comp_cdrom'].",". "".noHtml($_POST['comp_nome'])."', '".$_POST['comp_local']."', ". "".$_POST['comp_fornecedor'].",'".noHtml($_POST['comp_nf'])."','".noHtml($_POST['comp_coment'])."', ". "'".date("Y-m-d H:i:s")."', '".$comp_valor."', '".datam($_POST['comp_data_compra'])."', ". "'".$_POST['comp_inst']."', ".$_POST['comp_ccusto'].", '".$_POST['comp_tipo_equip']."', ". "".$_POST['comp_tipo_imp'].", ".$_POST['comp_resolucao'].", ".$_POST['comp_polegada'].", ". "'".$_POST['comp_fab']."', '".$_POST['comp_situac']."', ".$_POST['comp_tipo_garant'].", ". "".$_POST['comp_garant_meses']." ". ")"; $resultado = mysql_query($query) or die (TRANS('ERR_INSERT'). '<br>'.$query); if ($resultado == 0) { $aviso = TRANS('MSG_NOT_INCLUDE_DATA'); } else { $numero = mysql_insert_id(); $aviso = TRANS('MSG_OK_EQUIP_CAD_SUCESS'); $texto = "[Etiqueta = ".$_POST['comp_inv']."], [Unidade = ".$_POST['comp_inst']."]"; geraLog(LOG_PATH.'invmon.txt',date("d-m-Y H:i:s"),$_SESSION['s_usuario'], $_SERVER['PHP_SELF'],$texto); } } print "<script>mensagem('".$aviso."'); ". "redirect('mostra_consulta_inv.php?comp_inv=".$_POST['comp_inv']."&comp_inst=".$_POST['comp_inst']."');". "</script>";
}
$cab->set_foot(); ?> <script type='text/javascript'> <!--
function valida(){ var ok = validaForm('idTipo','COMBO','<?php print TRANS('FIELD_TYPE_EQUIP');?>' ,1); if (ok) var ok = validaForm('idFab','COMBO','<?php print TRANS('COL_MANUFACTURE');?>',1); if (ok) var ok = validaForm('idEtiqueta','INTEIRO','<?php print TRANS('OCO_FIELD_TAG');?>',1); if (ok) var ok = validaForm('idModelo','COMBO','<?php print TRANS('COL_MODEL');?>',1); if (ok) var ok = validaForm('idLocal','COMBO','<?php print TRANS('FIELD_LOCALIZATION');?>',1); if (ok) var ok = validaForm('idSituac','COMBO','<?php print TRANS('COL_SITUAC');?>',1); if (ok) var ok = validaForm('idUnidade','COMBO','<?php print TRANS('OCO_FIELD_UNIT');?>',1); if (ok) var ok = validaForm('idValor','MOEDASIMP','<?php print TRANS('FIELD_EQUIP_VALUE');?>',0); if (ok) var ok = validaForm('idDataCompra','DATA','<?php print TRANS('FIELD_DATE_PURCHASE');?>',0);
return ok;
}
function desabilita(v) { document.form1.ok.disabled=v; }
function desabilitaCarrega(v){ document.form1.ok2.disabled=v; }
function Habilitar(){ var inventario = document.form1.comp_inv.value; var ind_tipo_equip = document.form1.comp_tipo_equip.selectedIndex; var sel_tipo_equip = document.form1.comp_tipo_equip.options[ind_tipo_equip].value; var ind_comp_marca = document.form1.comp_marca.selectedIndex; var sel_comp_marca = document.form1.comp_marca.options[ind_comp_marca].value; var ind_fab = document.form1.comp_fab.selectedIndex; var sel_fab = document.form1.comp_fab.options[ind_fab].value; var ind_local = document.form1.comp_local.selectedIndex; var sel_local = document.form1.comp_local.options[ind_local].value; var ind_sit = document.form1.comp_situac.selectedIndex; var sel_sit = document.form1.comp_situac.options[ind_sit].value; var ind_inst = document.form1.comp_inst.selectedIndex; var sel_inst = document.form1.comp_inst.options[ind_inst].value;
if ((inventario =="")||(sel_tipo_equip==-1)||(sel_comp_marca==-1)||(sel_fab==-1)||(sel_local==-1)||(sel_sit==-1)||(sel_inst==-1)) { desabilita(true); //desabilita(false);
} else { desabilita(false);
}
}
function HabilitarCarrega(){ var ind_comp_marca = document.form1.comp_marca.selectedIndex; var sel_comp_marca = document.form1.comp_marca.options[ind_comp_marca].value; if (sel_comp_marca==-1) { desabilitaCarrega(true); } else{ desabilitaCarrega(false); }
}
//window.setInterval("Habilitar()",100); //window.setInterval("HabilitarCarrega()",100);
team = new Array( <?php $conta = 0; $conta_sub = 0; $sql="select * from tipo_equip order by tipo_nome";//Somente as áreas ativas $sql_result=mysql_query($sql); echo mysql_error(); $num=mysql_numrows($sql_result); while ($row_A=mysql_fetch_array($sql_result)){ $conta=$conta+1; $cod_item=$row_A['tipo_cod']; echo "new Array(\n"; $sub_sql="select * from marcas_comp where marc_tipo='$cod_item' order by marc_nome"; $sub_result=mysql_query($sub_sql); $num_sub=mysql_numrows($sub_result); if ($num_sub>=1){ echo "new Array("".TRANS('SEL_MODEL')."", -1),\n"; while ($rowx=mysql_fetch_array($sub_result)){ $codigo_sub=$rowx['marc_cod']; $sub_nome=$rowx['marc_nome']; $conta_sub=$conta_sub+1; if ($conta_sub==$num_sub){ echo "new Array("$sub_nome", $codigo_sub)\n"; $conta_sub=""; }else{ echo "new Array("$sub_nome", $codigo_sub),\n"; } } }else{ echo "new Array("".TRANS('OCO_SEL_ANY')."", -1)\n"; } if ($num>$conta){ echo "),\n"; } } echo ")\n"; echo ");\n"; ?>
Então apesr de ser mega iniciante no php, da pra ver onde ta meu erro que é na lin 887 quero saber ai do povo mais "mestre" o porque que a variavel $resultado não e igual ao mysql_query? se alguem souber e me ajudar a apontar o erro agradeço. Abraços | |
|