<?php
require_once 'header.php';
require_once 'erpc_unidades_toolbar.php';
require_once 'inc/usuario.php';

checkLogin('login.php');

?>

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
  <li role="presentation" class="active"><a href="#form1" aria-controls="form1" role="tab" data-toggle="tab">Dados Cadastrais</a></li>
  <!--
  <li role="presentation"><a href="#form2" aria-controls="form2" role="tab" data-toggle="tab">Form #2</a></li>
  <li role="presentation"><a href="#form3" aria-controls="form3" role="tab" data-toggle="tab">Form #3</a></li>
  <li role="presentation"><a href="#form4" aria-controls="form4" role="tab" data-toggle="tab">Form #4</a></li>
  -->
</ul>

<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="form1">
<form id=validate_custom  enctype="multipart/form-data"  method=POST action="erpc_unidades_ws.php">
  <input type=hidden name="id" id="id" class="validate[required] form-control" maxlength="08" size=8/>

  <div class=block>
    <div class=header>
      <h2>Incluir Unidades:</h2>
    </div>

    <div class="content controls">

      <div class="form-row">
        <div class="col-md-2"><label>Regime Tributário</label></div>
        <div class="col-md-2">
          <div class="input-group">
          <input type=number name="id_regime" id="id_regime" size="4">
          <div class="input-group-addon">
            <a href="erpc_dom_regime_tributario_helper.php" class='input-helper' data-remote="false" data-toggle="modal" data-target="#helper-modal-div" data-value="#id_regime" data-description="#ds_regime" data-title="Selecione:">
            <span class="fa fa-search"></span></a>
          </div>
        </div>
        </div>
        <div class="col-md-6"><input type=text name="ds_regime" id="ds_regime" class="validate[required] form-control" maxlength="100"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Sub Regime Tributário</label></div>
        <div class="col-md-2">
          <div class="input-group">
          <input type=number name="id_sub_regime_trib" id="id_sub_regime_trib" size="4">
          <div class="input-group-addon">
            <a href="erpc_dom_sub_regime_trib_helper.php" class='input-helper' data-remote="false" data-toggle="modal" data-target="#helper-modal-div" data-value="#id_sub_regime_trib" data-description="#ds_sub_regime_trib" data-title="Selecione:">
            <span class="fa fa-search"></span></a>
          </div>
        </div>
        </div>
        <div class="col-md-6"><input type=text name="ds_sub_regime_trib" id="ds_sub_regime_trib" class="form-control" maxlength="100"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Razão Social</label></div>
        <div class="col-md-10"><input type=text name="ds_razao_social" id="ds_razao_social" class="validate[required] form-control" maxlength="100"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Nome Fantasia</label></div>
        <div class="col-md-6"><input type=text name="ds_fantasia" id="ds_fantasia" class="validate[required] form-control" maxlength="40"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>CNPJ</label></div>
        <div class="col-md-4"><input name="ds_cnpj" id="ds_cnpj" class="mask_cnpj"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>I.E.</label></div>
        <div class="col-md-3"><input type=text name="ds_ie" id="ds_ie"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>CNAE Fiscal</label></div>
        <div class="col-md-1"><input type=number name="ds_cnae_fiscal" id="ds_cnae_fiscal"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Insc. Municipal</label></div>
        <div class="col-md-3"><input type=number name="ds_im" id="ds_im"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>I.E. Subst.Trib.</label></div>
        <div class="col-md-3"><input type=number name="ds_iest" id="ds_iest"/></div>
      </div>


      <div class="form-row">
        <div class="col-md-2"><label>CEP</label></div>
        <div class="col-md-2"><input type=text name="ds_cep" id="ds_cep" maxlenght="8" size="8" class="mask_cep"></div>
      </div> 

	  <div class="form-row">
        <div class="col-md-2"><label>Endereço</label></div>
        <div class="col-md-5"><input name="ds_endereco" id="ds_endereco" class="getCep_ds_logradouro form-control" maxlength="100"/></div>
        <div class="col-md-1"><label>Número</label></div>
        <div class="col-md-2"><input type=text name="ds_numero" id="ds_numero" class="validate[required] form-control" maxlength="10"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Complemento</label></div>
        <div class="col-md-6"><input name="ds_complemento" id="ds_complemento" maxlength="100"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Bairro</label></div>
        <div class="col-md-2"><input type=text name="ds_bairro" id="ds_bairro" class="getCep_ds_bairro validate[required] form-control" maxlength="60"/></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>Município</label></div>
        <div class="col-md-2">
          <div class="input-group">
            <input type=number class="getCep_id_municipio" name="id_municipio" id="id_municipio" maxlenght="10" size="4">
              <div class="input-group-addon">
              <a href="erpc_municipios_helper.php" class='input-helper' data-remote="false" data-toggle="modal" data-target="#helper-modal-div" data-parameter="" data-value="#id_municipio" data-description="#ds_municipio" data-title="Selecione:">
              <span class="fa fa-search"></span></a>
            </div>
          </div>
        </div>
        <div class="col-md-4"><input class="getCep_ds_municipio" name="ds_municipio" id="ds_municipio" readonly></div>
        <div class="col-md-2"><input class="getCep_ds_uf" name="ds_estado" id="ds_estado" readonly></div>
      </div>

      <div class="form-row">
        <div class="col-md-2"><label>E-mail</label></div>
        <div class="col-md-6"><input type=text name="ds_email" id="ds_email" maxlength="255" /></div>
      </div>

    <div class="row clear">&nbsp;</div>
    <div class="form-row">
      <div class=col-md-2>LogoTipo</div>
			<div class=col-md-9>
			<?
			/*if (substr($ds_idioma, -3)=='jpg' || substr($ds_arquivo, -3)=='png' || substr($ds_arquivo, -3)=='gif') {
                $prefix = substr($ds_arquivo, 5) =='http: ' || substr($ds_arquivo, 6) == 'https:' ? '' : '../';
                echo "<h6>Imagem atual</h6><img src='$prefix$ds_value' width='100px'><br>";
              }*/
            ?>
            <input name="arquivo" type="file"  accept="image/*" size="50"/>
			</div>
    </div>

    <div class=footer>
      <div class="side pull-right">
        <div class=btn-group>
            <button class="btn btn-success" type="submit" value="adicionar" name="adicionar">Adicionar</button>
            <button class="btn btn-default" type="button" onClick="window.history.go(-1)" value="Voltar">Voltar</button>
            
        <!--botao antigo
    <button class="btn btn-default" type=button onClick="$('#validate_custom').validationEngine('hide');">Hide prompts</button>            <button class="btn btn-success" type=submit>Submit</button>
    -->
        </div>
      </div>
    </div>


</div>
</div>
</form>
</div>
</div>



<?php include 'inc/helper_modal_div.php';?>
<?php include 'footer.php'; ?>
<script type="text/javascript" src="js/acme.js"></script>
<script type="text/javascript" >

    //$("#clientes[ds_ie]").keyup(function(){
    $("[name='ds_ie']").keyup(function(){
    	$(this).val($(this).val().replace(".", ""));
    });
    $("[name='ds_ie'").blur(function(){
    	$(this).val($(this).val().replace(".", ""));
    });
    
</script>
<script type="text/javascript" src="js\busca_CEP.js"></script>