<?php
    require 'conexion.php';
    require_once('functions.php');
	include(HEADER_TEMPLATE); 
    
	//$id_pedido = $_GET['id'];
	$id = $_GET['id'];

    // seleciona todos os registros da base com inner join cliente
    $sql = "SELECT ordem_corte.id_oc, companies.popular_name, pedidos.*, pedidos.obs AS obsPed FROM pedidos INNER JOIN companies on companies.id = pedidos.nr_company LEFT JOIN grade ON grade.id_pedido = pedidos.id INNER JOIN ordem_corte ON pedidos.id = ordem_corte.id_pedido WHERE pedidos.id = '$id'";
    $resultado = $mysqli->query($sql);
    $row = $resultado->fetch_array(MYSQLI_ASSOC);
?>
			
			<form name="gradePedido" method="POST" action="grade_update.php" autocomplete="off" onload="soma()">

                <input type="hidden" id="ativo" name="ativo" value="1" />
                <input type="hidden" id="id_pedido" name="id_pedido" value="<?php echo $id_pedido; ?>" />
                <input type="hidden" id="dir" name="dir" value="1" />
               
                <div class="container">  

                <table id="gradecabeca" class="table table-striped table-condensed table-bordered">  
                    <thead>  
                        <tr style="background-color: #67aded" align="center">  
                            <td><span style='font-weight:bold;'>ORDEM DE CORTE Nr.: <?php echo $row['id_oc'] ?></span></td>  
                        </tr>  
                    </thead>  
                </table>
                
                    <a href="#collapse1" data-toggle="collapse">detalhes do Pedido</a>
                    <div id="collapse1" class="collapse">
                        <div class="row">    
                            <div class="form-group col-md-2">
                                <label for="dtcadastro">Cadastro Pedido</label>
                                <input type="date" class="form-control" name="dtcadastro" id="dtcadastro" value="<?php echo $row['dtcadastro'] ?>" readonly="readonly" >
                            </div>

                            <div class="form-group col-md-1">
                                <label for="idpiloto">Lacre</label>
                                <input type="text" class="form-control" name="id_piloto" id="id_piloto" value="<?php echo $row['id_piloto'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-2">
                                <label for="nr_pedido">Nr Pedido</label>
                                <input type="number" class="form-control" id="nr_pedido" name="nr_pedido" value="<?php echo $row['nr_pedido'] ?>" readonly="readonly">
                            </div>
                            
                            <div class="form-group col-md-3">
                                <label for="revista">Revista</label>
                                <input type="text" class="form-control" id="revista" name="revista" value="<?php echo $row['revista'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-4">
                                <label for="popular_name">Cliente</label> 
                                <input type="text" class="form-control" id="popular_name" name="popular_name" value="<?php echo $row['popular_name'] ?>" readonly="readonly" >
                            </div>
                        </div>
                        <div class="row">
                               
                            <div class="form-group col-md-2">
                                <label for="referencia">Referência</label>
                                <input type="text" class="form-control" id="referencia" name="referencia" value="<?php echo $row['referencia'] ?>"readonly="readonly" >
                            </div>

                            <div class="form-group col-md-2">
                                <label for="descricao">Descrição</label>
                                <input type="text" class="form-control" id="descricao" name="descricao" value="<?php echo $row['descricao'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-2">
                                <label for="modelo">Modelo</label>
                                <input type="text" class="form-control" id="modelo" name="modelo" value="<?php echo $row['modelo'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-2">
                                <label for="modelagem">Modelagem</label>
                                <input type="text" class="form-control" id="modelagem" name="modelagem" value="<?php echo $row['modelagem'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-2">
                                <label for="tecido">Tecido</label>
                                <input type="text" class="form-control" id="tecido" name="tecido" value="<?php echo $row['tecido'] ?>" readonly="readonly">
                            </div>

                            <div class="form-group col-md-2">
                                <label for="tecido">Largura</label> <a href="pedido_modificar_tamanho_tecido.php?id=<?php echo $id ?>">altera</a>
                                <input type="text" class="form-control" id="tecido" name="tamanho" value="<?php echo $row['tamanho'] ?>" readonly="readonly">
                            </div>
                                                
                        </div>

                        <div class="row">
                            <div class="form-group col-md-2">
                                <label for="data_pre">Data Pré</label>
                                <input type="date" class="form-control" id="data_pre" name="data_pre" value="<?php echo $row['data_pre'] ?>" readonly="readonly">
                            </div>                        
                            <div class="form-group col-md-2">
                              <label for="dtpedido">Data do Pedido</label>
                                <input type="date" class="form-control" id="data_pedido" name="data_pedido" value="<?php echo $row['data_pedido'] ?>" readonly="readonly">                          
                            </div>
                            <div class="form-group col-md-2">
                              <label for="dtentrega">Data da Entrega</label>
                                <input type="date" class="form-control" id="data_entrega" name="data_entrega" value="<?php echo $row['data_entrega'] ?>" readonly="readonly">                          
                            </div>
                            <div class="form-group col-md-2">
                                <label for="qtd">Quantidade</label>
                                <input type="number" class="form-control" id="quantidade" name="quantidade" value="<?php echo $row['quantidade'] ?>" readonly="readonly">
                            </div>         
                            <div class="form-group col-sm-4 control-label">
                                <label for="obs">Observações do PEDIDO</label>
                                <div class="">
                                    <textarea name="obs" class="form-control" rows="1" cols="48" readonly="readonly" ><?php echo $row['obsPed']?></textarea>
                                </div>
                            </div>
                        </div>                       
                    </div>
                    <?php
                    $sql = "SELECT grade.*, companies.popular_name, pedidos.*, pedidos.obs AS obsPed FROM pedidos INNER JOIN companies on companies.id = pedidos.nr_company LEFT JOIN grade ON grade.id_pedido = pedidos.id WHERE grade.id_pedido = '$id' and grade.dir = '1'";
                    $resultado = $mysqli->query($sql);
                    $row = $resultado->fetch_array(MYSQLI_ASSOC);
                    ?>     
                    
                    <input type="hidden" id="ativo" name="ativo" value="1" />
                    <input type="hidden" id="id" name="id" value="<?php echo $id; ?>" />
                    <input type="hidden" id="dir" name="dir" value="1" />

                
                    
                    <div class="table-responsive">  
                        <table id="gradePedidoz" class="table table-striped table-condensed table-bordered">  
                            <thead>  
                                <tr style="background-color: #d3d3d3" align="center">  
                                <td width="10%"><span style='font-weight:bold;'>PEDIDO Nr. <?php echo $id; ?></span>
                                    <td>32</td>  
                                    <td>34</td>  
                                    <td>36</td>  
                                    <td>38</td>  
                                    <td>40</td>  
                                    <td>42</td>  
                                    <td>44</td>  
                                    <td>46</td>  
                                    <td>48</td>  
                                    <td>50</td>  
                                    <td>52</td>  
                                    <td>SUBTOTAL</td>  
                                </tr>  
                            </thead>  

                            
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                               
                                    <input type="text" size ="15" width="1" maxlength="15" id="tituloc1" name="tituloc1" value="<?php echo $row['tituloc1'] ?>" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdc1" name="tdc1" value="<?php echo $row['tdc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqc1" name="tqc1" value="<?php echo $row['tqc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsc1" name="tsc1" value="<?php echo $row['tsc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toc1" name="toc1" value="<?php echo $row['toc1'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="quc1" name="quc1" value="<?php echo $row['quc1'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdc1" name="qdc1" value="<?php echo $row['qdc1'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqc1" name="qqc1" value="<?php echo $row['qqc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsc1" name="qsc1" value="<?php echo $row['qsc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoc1" name="qoc1" value="<?php echo $row['qoc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cic1" name="cic1" value="<?php echo $row['cic1'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdc1" name="cdc1" value="<?php echo $row['cdc1'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalc1" name="subtotalc1" readonly="readonly">  
                               </td>     
                           </tr>  
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloc2'] ?>" id="tituloc2" name="tituloc2" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdc2" name="tdc2" value="<?php echo $row['tdc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqc2" name="tqc2" value="<?php echo $row['tqc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsc2" name="tsc2" value="<?php echo $row['tsc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toc2" name="toc2" value="<?php echo $row['toc2'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="quc2" name="quc2" value="<?php echo $row['quc2'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdc2" name="qdc2" value="<?php echo $row['qdc2'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqc2" name="qqc2" value="<?php echo $row['qqc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsc2" name="qsc2" value="<?php echo $row['qsc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoc2" name="qoc2" value="<?php echo $row['qoc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cic2" name="cic2" value="<?php echo $row['cic2'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdc2" name="cdc2" value="<?php echo $row['cdc2'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalc2" name="subtotalc2" readonly="readonly">  
                               </td>     
                           </tr>  
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloc3'] ?>" id="tituloc3" name="tituloc3" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdc3" name="tdc3" value="<?php echo $row['tdc3'] ?>" readonly="readonly"  >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqc3" name="tqc3" value="<?php echo $row['tqc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsc3" name="tsc3" value="<?php echo $row['tsc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toc3" name="toc3" value="<?php echo $row['toc3'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="quc3" name="quc3" value="<?php echo $row['quc3'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdc3" name="qdc3" value="<?php echo $row['qdc3'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqc3" name="qqc3" value="<?php echo $row['qqc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsc3" name="qsc3" value="<?php echo $row['qsc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoc3" name="qoc3" value="<?php echo $row['qoc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cic3" name="cic3" value="<?php echo $row['cic3'] ?>" readonly="readonly" >
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdc3" name="cdc3" value="<?php echo $row['cdc3'] ?>" readonly="readonly" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalc3" name="subtotalc3" readonly="readonly">  
                               </td>     
                           </tr>  
                           
                           <tr align="center" style="background-color: #96928f">  
                               <td width="10%">
                                Somatória
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdc" name="somatdc" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqc" name="somatqc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsc" name="somatsc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoc" name="somatoc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaquc" name="somaquc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdc" name="somaqdc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqc" name="somaqqc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsc" name="somaqsc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoc" name="somaqoc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacic" name="somacic" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdc" name="somacdc" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageralc" name="somageralc" >  
                               </td>     
                           </tr>  
                        </table>
                        <table id="gradeOCcortes" class="table table-striped table-condensed table-bordered">  
                            <thead>  
                                <tr style="background-color: #d4cbe4" align="center">  
                                    <td width="10%"><span style='font-weight:bold;'>RISCOS</span></td>  
                                    <td>32</td>  
                                    <td>34</td>  
                                    <td>36</td>  
                                    <td>38</td>  
                                    <td>40</td>  
                                    <td>42</td>  
                                    <td>44</td>  
                                    <td>46</td>  
                                    <td>48</td>  
                                    <td>50</td>  
                                    <td>52</td>  
                                    <td>SUBTOTAL</td>  
                                </tr>  
                            </thead>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" id="tituloa1" name="tituloa1" value="<?php echo $row['tituloa1'] ?>" style='text-transform:uppercase' autofocus>  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda1" name="tda1" value="<?php echo $row['tda1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa1" name="tqa1" value="<?php echo $row['tqa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa1" name="tsa1" value="<?php echo $row['tsa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa1" name="toa1" value="<?php echo $row['toa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua1" name="qua1" value="<?php echo $row['qua1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda1" name="qda1" value="<?php echo $row['qda1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa1" name="qqa1" value="<?php echo $row['qqa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa1" name="qsa1" value="<?php echo $row['qsa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa1" name="qoa1" value="<?php echo $row['qoa1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia1" name="cia1" value="<?php echo $row['cia1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda1" name="cda1" value="<?php echo $row['cda1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala1" name="subtotala1" readonly="readonly">  
                               </td>     
                            </tr>  
                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa2'] ?>" id="tituloa2" name="tituloa2">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda2" name="tda2" value="<?php echo $row['tda2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa2" name="tqa2" value="<?php echo $row['tqa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa2" name="tsa2" value="<?php echo $row['tsa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa2" name="toa2" value="<?php echo $row['toa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua2" name="qua2" value="<?php echo $row['qua2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda2" name="qda2" value="<?php echo $row['qda2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa2" name="qqa2" value="<?php echo $row['qqa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa2" name="qsa2" value="<?php echo $row['qsa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa2" name="qoa2" value="<?php echo $row['qoa2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia2" name="cia2" value="<?php echo $row['cia2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda2" name="cda2" value="<?php echo $row['cda2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala2" name="subtotala2" readonly="readonly" >  
                               </td>     
                            </tr>  
                           
                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa3'] ?>" id="tituloa3" name="tituloa3">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda3" name="tda3" value="<?php echo $row['tda3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa3" name="tqa3" value="<?php echo $row['tqa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa3" name="tsa3" value="<?php echo $row['tsa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa3" name="toa3" value="<?php echo $row['toa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua3" name="qua3" value="<?php echo $row['qua3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda3" name="qda3" value="<?php echo $row['qda3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa3" name="qqa3" value="<?php echo $row['qqa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa3" name="qsa3" value="<?php echo $row['qsa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa3" name="qoa3" value="<?php echo $row['qoa3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia3" name="cia3" value="<?php echo $row['cia3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda3" name="cda3" value="<?php echo $row['cda3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala3" name="subtotala3" readonly="readonly" >  
                               </td>     
                            </tr>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa4'] ?>" id="tituloa4" name="tituloa4">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda4" name="tda4" value="<?php echo $row['tda4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa4" name="tqa4" value="<?php echo $row['tqa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa4" name="tsa4" value="<?php echo $row['tsa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa4" name="toa4" value="<?php echo $row['toa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua4" name="qua4" value="<?php echo $row['qua4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda4" name="qda4" value="<?php echo $row['qda4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa4" name="qqa4" value="<?php echo $row['qqa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa4" name="qsa4" value="<?php echo $row['qsa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa4" name="qoa4" value="<?php echo $row['qoa4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia4" name="cia4" value="<?php echo $row['cia4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda4" name="cda4" value="<?php echo $row['cda4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala4" name="subtotala4" readonly="readonly" >  
                               </td>     
                            </tr>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa5'] ?>" id="tituloa5" name="tituloa5">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda5" name="tda5" value="<?php echo $row['tda5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa5" name="tqa5" value="<?php echo $row['tqa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa5" name="tsa5" value="<?php echo $row['tsa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa5" name="toa5" value="<?php echo $row['toa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua5" name="qua5" value="<?php echo $row['qua5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda5" name="qda5" value="<?php echo $row['qda5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa5" name="qqa5" value="<?php echo $row['qqa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa5" name="qsa5" value="<?php echo $row['qsa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa5" name="qoa5" value="<?php echo $row['qoa5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia5" name="cia5" value="<?php echo $row['cia5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda5" name="cda5" value="<?php echo $row['cda5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala5" name="subtotala5" readonly="readonly" >  
                               </td>     
                            </tr>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa6'] ?>" id="tituloa6" name="tituloa6">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda6" name="tda6" value="<?php echo $row['tda6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa6" name="tqa6" value="<?php echo $row['tqa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa6" name="tsa6" value="<?php echo $row['tsa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa6" name="toa6" value="<?php echo $row['toa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua6" name="qua6" value="<?php echo $row['qua6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda6" name="qda6" value="<?php echo $row['qda6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa6" name="qqa6" value="<?php echo $row['qqa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa6" name="qsa6" value="<?php echo $row['qsa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa6" name="qoa6" value="<?php echo $row['qoa6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia6" name="cia6" value="<?php echo $row['cia6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda6" name="cda6" value="<?php echo $row['cda6'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala6" name="subtotala6" readonly="readonly" >  
                               </td>     
                            </tr>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa7'] ?>" id="tituloa7" name="tituloa7">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda7" name="tda7" value="<?php echo $row['tda7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa7" name="tqa7" value="<?php echo $row['tqa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa7" name="tsa7" value="<?php echo $row['tsa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa7" name="toa7" value="<?php echo $row['toa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua7" name="qua7" value="<?php echo $row['qua7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda7" name="qda7" value="<?php echo $row['qda7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa7" name="qqa7" value="<?php echo $row['qqa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa7" name="qsa7" value="<?php echo $row['qsa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa7" name="qoa7" value="<?php echo $row['qoa7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia7" name="cia7" value="<?php echo $row['cia7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda7" name="cda7" value="<?php echo $row['cda7'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala7" name="subtotala7" readonly="readonly">  
                               </td>     
                            </tr>  
                           
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa8'] ?>" id="tituloa8" name="tituloa8">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda8" name="tda8" value="<?php echo $row['tda8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa8" name="tqa8" value="<?php echo $row['tqa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa8" name="tsa8" value="<?php echo $row['tsa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa8" name="toa8" value="<?php echo $row['toa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua8" name="qua8" value="<?php echo $row['qua8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda8" name="qda8" value="<?php echo $row['qda8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa8" name="qqa8" value="<?php echo $row['qqa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa8" name="qsa8" value="<?php echo $row['qsa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa8" name="qoa8" value="<?php echo $row['qoa8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia8" name="cia8" value="<?php echo $row['cia8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda8" name="cda8" value="<?php echo $row['cda8'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala8" name="subtotala8" readonly="readonly">  
                               </td>     
                            </tr>  

                            <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloa9'] ?>" id="tituloa9" name="tituloa9">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tda9" name="tda9" value="<?php echo $row['tda9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqa9" name="tqa9" value="<?php echo $row['tqa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsa9" name="tsa9" value="<?php echo $row['tsa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toa9" name="toa9" value="<?php echo $row['toa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qua9" name="qua9" value="<?php echo $row['qua9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qda9" name="qda9" value="<?php echo $row['qda9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqa9" name="qqa9" value="<?php echo $row['qqa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsa9" name="qsa9" value="<?php echo $row['qsa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoa9" name="qoa9" value="<?php echo $row['qoa9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cia9" name="cia9" value="<?php echo $row['cia9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cda9" name="cda9" value="<?php echo $row['cda9'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotala9" name="subtotala9" readonly="readonly" >  
                               </td>     
                            </tr>  
                           
                            <tr align="center" style="background-color: #96928f">  
                               <td width="10%">
                                Somatória
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatda" name="somatda" readonly="readonly" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqa" name="somatqa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsa" name="somatsa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoa" name="somatoa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqua" name="somaqua" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqda" name="somaqda" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqa" name="somaqqa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsa" name="somaqsa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoa" name="somaqoa" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacia" name="somacia" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacda" name="somacda" readonly="readonly">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somagerala" name="somagerala" readonly="readonly">  
                               </td>     
                            </tr>                                   
                            <tr align="center" style="background-color: #96928f">  
                               <td width="10%">
                                Dif. (Pedido x Riscos)
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdadif" name="somatdadif" readonly="readonly" ></p>
                               </td>  
                               <td> 
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqadif" name="somatqadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsadif" name="somatsadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoadif" name="somatoadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaquadif" name="somaquadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdadif" name="somaqdadif" readonly="readonly"></p> 
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqadif" name="somaqqadif" readonly="readonly"></p>
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsadif" name="somaqsadif" readonly="readonly"></p> 
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoadif" name="somaqoadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaciadif" name="somaciadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdadif" name="somacdadif" readonly="readonly"></p>  
                               </td>  
                               <td>  
                                    <p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageraladif" name="somageraladif" readonly="readonly"></p>  
                               </td>     
                            </tr>  
                            
                        </table>
                        
                        <table id="gradeOCcortes" class="table table-striped table-condensed table-bordered">  
                            <thead>  
                                <tr style="background-color: #d4cbe4" align="center">  
                                    <td width="10%"><span style='font-weight:bold;'>FORRO</span></td>
                                    <td>32</td>  
                                    <td>34</td>  
                                    <td>36</td>  
                                    <td>38</td>  
                                    <td>40</td>  
                                    <td>42</td>  
                                    <td>44</td>  
                                    <td>46</td>  
                                    <td>48</td>  
                                    <td>50</td>  
                                    <td>52</td>  
                                    <td>SUBTOTAL</td>  
                                </tr>  
                            </thead>  

                           <tr align="center" style="font-weight:bold">  
                           
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" id="titulob1" name="titulob1" value="<?php echo $row['titulob1'] ?>" style='text-transform:uppercase' autofocus>  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdb1" name="tdb1" value="<?php echo $row['tdb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqb1" name="tqb1" value="<?php echo $row['tqb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsb1" name="tsb1" value="<?php echo $row['tsb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tob1" name="tob1" value="<?php echo $row['tob1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qub1" name="qub1" value="<?php echo $row['qub1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdb1" name="qdb1" value="<?php echo $row['qdb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqb1" name="qqb1" value="<?php echo $row['qqb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsb1" name="qsb1" value="<?php echo $row['qsb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qob1" name="qob1" value="<?php echo $row['qob1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cib1" name="cib1" value="<?php echo $row['cib1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdb1" name="cdb1" value="<?php echo $row['cdb1'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalb1" name="subtotalb1" readonly="readonly">  
                               </td>     
                           </tr>  
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulob2'] ?>" id="titulob2" name="titulob2">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdb2" name="tdb2" value="<?php echo $row['tdb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqb2" name="tqb2" value="<?php echo $row['tqb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsb2" name="tsb2" value="<?php echo $row['tsb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tob2" name="tob2" value="<?php echo $row['tob2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qub2" name="qub2" value="<?php echo $row['qub2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdb2" name="qdb2" value="<?php echo $row['qdb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqb2" name="qqb2" value="<?php echo $row['qqb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsb2" name="qsb2" value="<?php echo $row['qsb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qob2" name="qob2" value="<?php echo $row['qob2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cib2" name="cib2" value="<?php echo $row['cib2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdb2" name="cdb2" value="<?php echo $row['cdb2'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalb2" name="subtotalb2" readonly="readonly">  
                               </td>     
                           </tr>  
                           
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulob3'] ?>" id="titulob3" name="titulob3">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdb3" name="tdb3" value="<?php echo $row['tdb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqb3" name="tqb3" value="<?php echo $row['tqb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsb3" name="tsb3" value="<?php echo $row['tsb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tob3" name="tob3" value="<?php echo $row['tob3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qub3" name="qub3" value="<?php echo $row['qub3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdb3" name="qdb3" value="<?php echo $row['qdb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqb3" name="qqb3" value="<?php echo $row['qqb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsb3" name="qsb3" value="<?php echo $row['qsb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qob3" name="qob3" value="<?php echo $row['qob3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cib3" name="cib3" value="<?php echo $row['cib3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdb3" name="cdb3" value="<?php echo $row['cdb3'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalb3" name="subtotalb3" readonly="readonly" >  
                               </td>     
                           </tr>  

                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulob4'] ?>" id="titulob4" name="titulob4">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdb4" name="tdb4" value="<?php echo $row['tdb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqb4" name="tqb4" value="<?php echo $row['tqb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsb4" name="tsb4" value="<?php echo $row['tsb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tob4" name="tob4" value="<?php echo $row['tob4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qub4" name="qub4" value="<?php echo $row['qub4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdb4" name="qdb4" value="<?php echo $row['qdb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqb4" name="qqb4" value="<?php echo $row['qqb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsb4" name="qsb4" value="<?php echo $row['qsb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qob4" name="qob4" value="<?php echo $row['qob4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cib4" name="cib4" value="<?php echo $row['cib4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdb4" name="cdb4" value="<?php echo $row['cdb4'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalb4" name="subtotalb4" readonly="readonly">  
                               </td>     
                           </tr>  

                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulob5'] ?>" id="titulob5" name="titulob5">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdb5" name="tdb5" value="<?php echo $row['tdb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqb5" name="tqb5" value="<?php echo $row['tqb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsb5" name="tsb5" value="<?php echo $row['tsb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tob5" name="tob5" value="<?php echo $row['tob5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qub5" name="qub5" value="<?php echo $row['qub5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdb5" name="qdb5" value="<?php echo $row['qdb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqb5" name="qqb5" value="<?php echo $row['qqb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsb5" name="qsb5" value="<?php echo $row['qsb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qob5" name="qob5" value="<?php echo $row['qob5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cib5" name="cib5" value="<?php echo $row['cib5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdb5" name="cdb5" value="<?php echo $row['cdb5'] ?>" onkeypress='return SomenteNumero(event)' onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalb5" name="subtotalb5" readonly="readonly">  
                               </td>     
                           </tr>  
                           
                           <tr align="center" style="background-color: #96928f">  
                               <td width="10%">
                                Somatória
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdb" name="somatdb" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqb" name="somatqb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsb" name="somatsb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatob" name="somatob" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqub" name="somaqub" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdb" name="somaqdb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqb" name="somaqqb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsb" name="somaqsb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqob" name="somaqob" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacib" name="somacib" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdb" name="somacdb" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageralb" name="somageralb" >  
                               </td>     
                            </tr> 
                        </table>
                        <table id="gradePedidos" class="table table-striped table-condensed table-bordered">  
                            <thead>  
                                <tr style="background-color: #d4cbe4" align="center">  
                                    <td width="10%"><span style='font-weight:bold;'>FECHAMENTO</span></td> 
                                    <td>32</td>  
                                    <td>34</td>  
                                    <td>36</td>  
                                    <td>38</td>  
                                    <td>40</td>  
                                    <td>42</td>  
                                    <td>44</td>  
                                    <td>46</td>  
                                    <td>48</td>  
                                    <td>50</td>  
                                    <td>52</td>  
                                    <td>SUBTOTAL</td>  
                                </tr>  
                            </thead>  

                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">                               
                                    <input type="text" size ="15" width="1" maxlength="15" id="titulod1" name="titulod1" value="<?php echo $row['titulod1'] ?>" style='text-transform:uppercase' autofocus >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd1" name="tdd1" value="<?php echo $row['tdd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd1" name="tqd1" value="<?php echo $row['tqd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd1" name="tsd1" value="<?php echo $row['tsd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod1" name="tod1" value="<?php echo $row['tod1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud1" name="qud1" value="<?php echo $row['qud1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd1" name="qdd1" value="<?php echo $row['qdd1'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd1" name="qqd1" value="<?php echo $row['qqd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd1" name="qsd1" value="<?php echo $row['qsd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod1" name="qod1" value="<?php echo $row['qod1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid1" name="cid1" value="<?php echo $row['cid1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd1" name="cdd1" value="<?php echo $row['cdd1'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald1" name="subtotald1" readonly="readonly">  
                               </td>     
                           </tr>  
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulod2'] ?>" id="titulod2" name="titulod2"   >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd2" name="tdd2" value="<?php echo $row['tdd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd2" name="tqd2" value="<?php echo $row['tqd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd2" name="tsd2" value="<?php echo $row['tsd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod2" name="tod2" value="<?php echo $row['tod2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud2" name="qud2" value="<?php echo $row['qud2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd2" name="qdd2" value="<?php echo $row['qdd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd2" name="qqd2" value="<?php echo $row['qqd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd2" name="qsd2" value="<?php echo $row['qsd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod2" name="qod2" value="<?php echo $row['qod2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid2" name="cid2" value="<?php echo $row['cid2'] ?>" onkeypress='return SomenteNumero(event)'  onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd2" name="cdd2" value="<?php echo $row['cdd2'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald2" name="subtotald2" readonly="readonly">  
                               </td>     
                           </tr>  
                           <tr align="center" style="font-weight:bold">  
                               <td width="10%">
                                    <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['titulod3'] ?>" id="titulod3" name="titulod3"   >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd3" name="tdd3" value="<?php echo $row['tdd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma()">  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd3" name="tqd3" value="<?php echo $row['tqd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd3" name="tsd3" value="<?php echo $row['tsd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod3" name="tod3" value="<?php echo $row['tod3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud3" name="qud3" value="<?php echo $row['qud3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd3" name="qdd3" value="<?php echo $row['qdd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd3" name="qqd3" value="<?php echo $row['qqd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd3" name="qsd3" value="<?php echo $row['qsd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod3" name="qod3" value="<?php echo $row['qod3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid3" name="cid3" value="<?php echo $row['cid3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd3" name="cdd3" value="<?php echo $row['cdd3'] ?>" onkeypress='return SomenteNumero(event)'   onBlur="soma();">  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald3" name="subtotald3" readonly="readonly">  
                               </td>     
                           </tr>  
                           <input type="hidden" name="titulod4" value="" />
                           <input type="hidden" name="tdd4" value="0" />
                           <input type="hidden" name="tqd4" value="0" />
                           <input type="hidden" name="tsd4" value="0" />
                           <input type="hidden" name="tod4" value="0" />
                           <input type="hidden" name="qud4" value="0" />
                           <input type="hidden" name="qdd4" value="0" />
                           <input type="hidden" name="qqd4" value="0" />
                           <input type="hidden" name="qsd4" value="0" />
                           <input type="hidden" name="qod4" value="0" />
                           <input type="hidden" name="cid4" value="0" />
                           <input type="hidden" name="cdd4" value="0" />
                           <input type="hidden" name="subtotald4" value="0" />
                           
                           <input type="hidden" name="titulod5" value="" />
                           <input type="hidden" name="tdd5" value="0" />
                           <input type="hidden" name="tqd5" value="0" />
                           <input type="hidden" name="tsd5" value="0" />
                           <input type="hidden" name="tod5" value="0" />
                           <input type="hidden" name="qud5" value="0" />
                           <input type="hidden" name="qdd5" value="0" />
                           <input type="hidden" name="qqd5" value="0" />
                           <input type="hidden" name="qsd5" value="0" />
                           <input type="hidden" name="qod5" value="0" />
                           <input type="hidden" name="cid5" value="0" />
                           <input type="hidden" name="cdd5" value="0" />
                           <input type="hidden" name="subtotald5" value="0" />
                           
                           <tr align="center" style="background-color: #96928f">  
                               <td width="10%">
                                Somatória
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdd" name="somatdd" >  
                               </td>  
                               <td> 
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqd" name="somatqd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsd" name="somatsd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatod" name="somatod" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqud" name="somaqud" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdd" name="somaqdd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqd" name="somaqqd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsd" name="somaqsd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqod" name="somaqod" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacid" name="somacid" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdd" name="somacdd" >  
                               </td>  
                               <td>  
                                    <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somagerald" name="somagerald" >  
                               </td>     
                           </tr>                                   
                        </table>    

                        <table id="gradeobs" class="table table-striped table-condensed table-bordered">  
                            <thead>  
                                <tr style="background-color: #d4cbe4" align="center">  
                                    <td>OBSERVAÇÕES ORDEM DE CORTE</td>  
                                </tr>  
                            </thead>  

                            <tr align="center" style="font-weight:bold">  
                                <td>  
                                    <textarea name="obs_grade" class="form-control" rows="2" style='text-transform:uppercase'><?php echo $row['obs_grade']?> </textarea>
                                </td>  
                            </tr>
                        </table>
                        <form class="navbar-form">
                            <div class=text-left>
                                <a href="oc_index.php" class="btn btn-primary">Voltar</a>                            
                                <input type="submit" value="Salvar Grade" class="btn btn-danger" />
                                
                            </div>
                        </form>
                    </div>     






                    
            </form>  

<script type="text/javascript">
window.onload = function()
{
   soma();
}
</script>   

<script language='JavaScript'>
function soma() 
{    

//// PEDIDO = C

gradePedido.subtotalc1.value = (gradePedido.tdc1.value*1) + (gradePedido.tqc1.value*1) + (gradePedido.tsc1.value*1) + (gradePedido.toc1.value*1) + (gradePedido.quc1.value*1) + (gradePedido.qdc1.value*1) + (gradePedido.qqc1.value*1) + (gradePedido.qsc1.value*1) + (gradePedido.qoc1.value*1) + (gradePedido.cic1.value*1) + (gradePedido.cdc1.value*1)
gradePedido.subtotalc2.value = (gradePedido.tdc2.value*1) + (gradePedido.tqc2.value*1) + (gradePedido.tsc2.value*1) + (gradePedido.toc2.value*1) + (gradePedido.quc2.value*1) + (gradePedido.qdc2.value*1) + (gradePedido.qqc2.value*1) + (gradePedido.qsc2.value*1) + (gradePedido.qoc2.value*1) + (gradePedido.cic2.value*1) + (gradePedido.cdc2.value*1)
gradePedido.subtotalc3.value = (gradePedido.tdc3.value*1) + (gradePedido.tqc3.value*1) + (gradePedido.tsc3.value*1) + (gradePedido.toc3.value*1) + (gradePedido.quc3.value*1) + (gradePedido.qdc3.value*1) + (gradePedido.qqc3.value*1) + (gradePedido.qsc3.value*1) + (gradePedido.qoc3.value*1) + (gradePedido.cic3.value*1) + (gradePedido.cdc3.value*1)

gradePedido.somatdc.value = (gradePedido.tdc1.value*1) + (gradePedido.tdc2.value*1) + (gradePedido.tdc3.value*1)
gradePedido.somatqc.value = (gradePedido.tqc1.value*1) + (gradePedido.tqc2.value*1) + (gradePedido.tqc3.value*1)
gradePedido.somatsc.value = (gradePedido.tsc1.value*1) + (gradePedido.tsc2.value*1) + (gradePedido.tsc3.value*1)
gradePedido.somatoc.value = (gradePedido.toc1.value*1) + (gradePedido.toc2.value*1) + (gradePedido.toc3.value*1)
gradePedido.somaquc.value = (gradePedido.quc1.value*1) + (gradePedido.quc2.value*1) + (gradePedido.quc3.value*1)
gradePedido.somaqdc.value = (gradePedido.qdc1.value*1) + (gradePedido.qdc2.value*1) + (gradePedido.qdc3.value*1)
gradePedido.somaqqc.value = (gradePedido.qqc1.value*1) + (gradePedido.qqc2.value*1) + (gradePedido.qqc3.value*1)
gradePedido.somaqsc.value = (gradePedido.qsc1.value*1) + (gradePedido.qsc2.value*1) + (gradePedido.qsc3.value*1)
gradePedido.somaqoc.value = (gradePedido.qoc1.value*1) + (gradePedido.qoc2.value*1) + (gradePedido.qoc3.value*1)
gradePedido.somacic.value = (gradePedido.cic1.value*1) + (gradePedido.cic2.value*1) + (gradePedido.cic3.value*1)
gradePedido.somacdc.value = (gradePedido.cdc1.value*1) + (gradePedido.cdc2.value*1) + (gradePedido.cdc3.value*1)

gradePedido.somageralc.value = 
(gradePedido.somatdc.value*1) + (gradePedido.somatqc.value*1) + (gradePedido.somatsc.value*1) + (gradePedido.somatoc.value*1) + 
(gradePedido.somaquc.value*1) + (gradePedido.somaqdc.value*1) + (gradePedido.somaqqc.value*1) + (gradePedido.somaqsc.value*1) + 
(gradePedido.somaqoc.value*1) + (gradePedido.somacic.value*1) + (gradePedido.somacdc.value*1)

///// RISCOS = A

gradePedido.subtotala1.value = (gradePedido.tda1.value*1) + (gradePedido.tqa1.value*1) + (gradePedido.tsa1.value*1) + (gradePedido.toa1.value*1) + (gradePedido.qua1.value*1) + (gradePedido.qda1.value*1) + (gradePedido.qqa1.value*1) + (gradePedido.qsa1.value*1) + (gradePedido.qoa1.value*1) + (gradePedido.cia1.value*1) + (gradePedido.cda1.value*1)
gradePedido.subtotala2.value = (gradePedido.tda2.value*1) + (gradePedido.tqa2.value*1) + (gradePedido.tsa2.value*1) + (gradePedido.toa2.value*1) + (gradePedido.qua2.value*1) + (gradePedido.qda2.value*1) + (gradePedido.qqa2.value*1) + (gradePedido.qsa2.value*1) + (gradePedido.qoa2.value*1) + (gradePedido.cia2.value*1) + (gradePedido.cda2.value*1)
gradePedido.subtotala3.value = (gradePedido.tda3.value*1) + (gradePedido.tqa3.value*1) + (gradePedido.tsa3.value*1) + (gradePedido.toa3.value*1) + (gradePedido.qua3.value*1) + (gradePedido.qda3.value*1) + (gradePedido.qqa3.value*1) + (gradePedido.qsa3.value*1) + (gradePedido.qoa3.value*1) + (gradePedido.cia3.value*1) + (gradePedido.cda3.value*1)

gradePedido.subtotala4.value = (gradePedido.tda4.value*1) + (gradePedido.tqa4.value*1) + (gradePedido.tsa4.value*1) + (gradePedido.toa4.value*1) + (gradePedido.qua4.value*1) + (gradePedido.qda4.value*1) + (gradePedido.qqa4.value*1) + (gradePedido.qsa4.value*1) + (gradePedido.qoa4.value*1) + (gradePedido.cia4.value*1) + (gradePedido.cda4.value*1)
gradePedido.subtotala5.value = (gradePedido.tda5.value*1) + (gradePedido.tqa5.value*1) + (gradePedido.tsa5.value*1) + (gradePedido.toa5.value*1) + (gradePedido.qua5.value*1) + (gradePedido.qda5.value*1) + (gradePedido.qqa5.value*1) + (gradePedido.qsa5.value*1) + (gradePedido.qoa5.value*1) + (gradePedido.cia5.value*1) + (gradePedido.cda5.value*1)
gradePedido.subtotala6.value = (gradePedido.tda6.value*1) + (gradePedido.tqa6.value*1) + (gradePedido.tsa6.value*1) + (gradePedido.toa6.value*1) + (gradePedido.qua6.value*1) + (gradePedido.qda6.value*1) + (gradePedido.qqa6.value*1) + (gradePedido.qsa6.value*1) + (gradePedido.qoa6.value*1) + (gradePedido.cia6.value*1) + (gradePedido.cda6.value*1)

gradePedido.subtotala7.value = (gradePedido.tda7.value*1) + (gradePedido.tqa7.value*1) + (gradePedido.tsa7.value*1) + (gradePedido.toa7.value*1) + (gradePedido.qua7.value*1) + (gradePedido.qda7.value*1) + (gradePedido.qqa7.value*1) + (gradePedido.qsa7.value*1) + (gradePedido.qoa7.value*1) + (gradePedido.cia7.value*1) + (gradePedido.cda7.value*1)
gradePedido.subtotala8.value = (gradePedido.tda8.value*1) + (gradePedido.tqa8.value*1) + (gradePedido.tsa8.value*1) + (gradePedido.toa8.value*1) + (gradePedido.qua8.value*1) + (gradePedido.qda8.value*1) + (gradePedido.qqa8.value*1) + (gradePedido.qsa8.value*1) + (gradePedido.qoa8.value*1) + (gradePedido.cia8.value*1) + (gradePedido.cda8.value*1)
gradePedido.subtotala9.value = (gradePedido.tda9.value*1) + (gradePedido.tqa9.value*1) + (gradePedido.tsa9.value*1) + (gradePedido.toa9.value*1) + (gradePedido.qua9.value*1) + (gradePedido.qda9.value*1) + (gradePedido.qqa9.value*1) + (gradePedido.qsa9.value*1) + (gradePedido.qoa9.value*1) + (gradePedido.cia9.value*1) + (gradePedido.cda9.value*1)

gradePedido.somatda.value = (gradePedido.tda1.value*1) + (gradePedido.tda2.value*1) + (gradePedido.tda3.value*1) + (gradePedido.tda4.value*1) + (gradePedido.tda5.value*1) + (gradePedido.tda6.value*1) + (gradePedido.tda7.value*1) + (gradePedido.tda8.value*1) + (gradePedido.tda9.value*1)
gradePedido.somatqa.value = (gradePedido.tqa1.value*1) + (gradePedido.tqa2.value*1) + (gradePedido.tqa3.value*1) + (gradePedido.tqa4.value*1) + (gradePedido.tqa5.value*1) + (gradePedido.tqa6.value*1) + (gradePedido.tqa7.value*1) + (gradePedido.tqa8.value*1) + (gradePedido.tqa9.value*1)
gradePedido.somatsa.value = (gradePedido.tsa1.value*1) + (gradePedido.tsa2.value*1) + (gradePedido.tsa3.value*1) + (gradePedido.tsa4.value*1) + (gradePedido.tsa5.value*1) + (gradePedido.tsa6.value*1) + (gradePedido.tsa7.value*1) + (gradePedido.tsa8.value*1) + (gradePedido.tsa9.value*1)
gradePedido.somatoa.value = (gradePedido.toa1.value*1) + (gradePedido.toa2.value*1) + (gradePedido.toa3.value*1) + (gradePedido.toa4.value*1) + (gradePedido.toa5.value*1) + (gradePedido.toa6.value*1) + (gradePedido.toa7.value*1) + (gradePedido.toa8.value*1) + (gradePedido.toa9.value*1)
gradePedido.somaqua.value = (gradePedido.qua1.value*1) + (gradePedido.qua2.value*1) + (gradePedido.qua3.value*1) + (gradePedido.qua4.value*1) + (gradePedido.qua5.value*1) + (gradePedido.qua6.value*1) + (gradePedido.qua7.value*1) + (gradePedido.qua8.value*1) + (gradePedido.qua9.value*1)
gradePedido.somaqda.value = (gradePedido.qda1.value*1) + (gradePedido.qda2.value*1) + (gradePedido.qda3.value*1) + (gradePedido.qda4.value*1) + (gradePedido.qda5.value*1) + (gradePedido.qda6.value*1) + (gradePedido.qda7.value*1) + (gradePedido.qda8.value*1) + (gradePedido.qda9.value*1)
gradePedido.somaqqa.value = (gradePedido.qqa1.value*1) + (gradePedido.qqa2.value*1) + (gradePedido.qqa3.value*1) + (gradePedido.qqa4.value*1) + (gradePedido.qqa5.value*1) + (gradePedido.qqa6.value*1) + (gradePedido.qqa7.value*1) + (gradePedido.qqa8.value*1) + (gradePedido.qqa9.value*1)
gradePedido.somaqsa.value = (gradePedido.qsa1.value*1) + (gradePedido.qsa2.value*1) + (gradePedido.qsa3.value*1) + (gradePedido.qsa4.value*1) + (gradePedido.qsa5.value*1) + (gradePedido.qsa6.value*1) + (gradePedido.qsa7.value*1) + (gradePedido.qsa8.value*1) + (gradePedido.qsa9.value*1)
gradePedido.somaqoa.value = (gradePedido.qoa1.value*1) + (gradePedido.qoa2.value*1) + (gradePedido.qoa3.value*1) + (gradePedido.qoa4.value*1) + (gradePedido.qoa5.value*1) + (gradePedido.qoa6.value*1) + (gradePedido.qoa7.value*1) + (gradePedido.qoa8.value*1) + (gradePedido.qoa9.value*1)
gradePedido.somacia.value = (gradePedido.cia1.value*1) + (gradePedido.cia2.value*1) + (gradePedido.cia3.value*1) + (gradePedido.cia4.value*1) + (gradePedido.cia5.value*1) + (gradePedido.cia6.value*1) + (gradePedido.cia7.value*1) + (gradePedido.cia8.value*1) + (gradePedido.cia9.value*1)
gradePedido.somacda.value = (gradePedido.cda1.value*1) + (gradePedido.cda2.value*1) + (gradePedido.cda3.value*1) + (gradePedido.cda4.value*1) + (gradePedido.cda5.value*1) + (gradePedido.cda6.value*1) + (gradePedido.cda7.value*1) + (gradePedido.cda8.value*1) + (gradePedido.cda9.value*1)

///// DIFERENÇA RISCOS X PEDIDO
gradePedido.somatdadif.value = (gradePedido.somatda.value*1) - (gradePedido.somatdc.value*1)
gradePedido.somatqadif.value = (gradePedido.somatqa.value*1) - (gradePedido.somatqc.value*1)
gradePedido.somatsadif.value = (gradePedido.somatsa.value*1) - (gradePedido.somatsc.value*1)
gradePedido.somatoadif.value = (gradePedido.somatoa.value*1) - (gradePedido.somatoc.value*1)
gradePedido.somaquadif.value = (gradePedido.somaqua.value*1) - (gradePedido.somaquc.value*1)
gradePedido.somaqdadif.value = (gradePedido.somaqda.value*1) - (gradePedido.somaqdc.value*1)
gradePedido.somaqqadif.value = (gradePedido.somaqqa.value*1) - (gradePedido.somaqqc.value*1)
gradePedido.somaqsadif.value = (gradePedido.somaqsa.value*1) - (gradePedido.somaqsc.value*1)
gradePedido.somaqoadif.value = (gradePedido.somaqoa.value*1) - (gradePedido.somaqoc.value*1)
gradePedido.somaciadif.value = (gradePedido.somacia.value*1) - (gradePedido.somacic.value*1)
gradePedido.somacdadif.value = (gradePedido.somacda.value*1) - (gradePedido.somacdc.value*1)


gradePedido.somagerala.value = 
(gradePedido.somatda.value*1) + (gradePedido.somatqa.value*1) + (gradePedido.somatsa.value*1) + (gradePedido.somatoa.value*1) + 
(gradePedido.somaqua.value*1) + (gradePedido.somaqda.value*1) + (gradePedido.somaqqa.value*1) + (gradePedido.somaqsa.value*1) + 
(gradePedido.somaqoa.value*1) + (gradePedido.somacia.value*1) + (gradePedido.somacda.value*1)

gradePedido.somageraladif.value = (gradePedido.somagerala.value*1) - (gradePedido.somageralc.value*1)

///// FORRO = B

gradePedido.subtotalb1.value = (gradePedido.tdb1.value*1) + (gradePedido.tqb1.value*1) + (gradePedido.tsb1.value*1) + (gradePedido.tob1.value*1) + (gradePedido.qub1.value*1) + (gradePedido.qdb1.value*1) + (gradePedido.qqb1.value*1) + (gradePedido.qsb1.value*1) + (gradePedido.qob1.value*1) + (gradePedido.cib1.value*1) + (gradePedido.cdb1.value*1)
gradePedido.subtotalb2.value = (gradePedido.tdb2.value*1) + (gradePedido.tqb2.value*1) + (gradePedido.tsb2.value*1) + (gradePedido.tob2.value*1) + (gradePedido.qub2.value*1) + (gradePedido.qdb2.value*1) + (gradePedido.qqb2.value*1) + (gradePedido.qsb2.value*1) + (gradePedido.qob2.value*1) + (gradePedido.cib2.value*1) + (gradePedido.cdb2.value*1)
gradePedido.subtotalb3.value = (gradePedido.tdb3.value*1) + (gradePedido.tqb3.value*1) + (gradePedido.tsb3.value*1) + (gradePedido.tob3.value*1) + (gradePedido.qub3.value*1) + (gradePedido.qdb3.value*1) + (gradePedido.qqb3.value*1) + (gradePedido.qsb3.value*1) + (gradePedido.qob3.value*1) + (gradePedido.cib3.value*1) + (gradePedido.cdb3.value*1)

gradePedido.subtotalb4.value = (gradePedido.tdb4.value*1) + (gradePedido.tqb4.value*1) + (gradePedido.tsb4.value*1) + (gradePedido.tob4.value*1) + (gradePedido.qub4.value*1) + (gradePedido.qdb4.value*1) + (gradePedido.qqb4.value*1) + (gradePedido.qsb4.value*1) + (gradePedido.qob4.value*1) + (gradePedido.cib4.value*1) + (gradePedido.cdb4.value*1)
gradePedido.subtotalb5.value = (gradePedido.tdb5.value*1) + (gradePedido.tqb5.value*1) + (gradePedido.tsb5.value*1) + (gradePedido.tob5.value*1) + (gradePedido.qub5.value*1) + (gradePedido.qdb5.value*1) + (gradePedido.qqb5.value*1) + (gradePedido.qsb5.value*1) + (gradePedido.qob5.value*1) + (gradePedido.cib5.value*1) + (gradePedido.cdb5.value*1)

gradePedido.somatdb.value = (gradePedido.tdb1.value*1) + (gradePedido.tdb2.value*1) + (gradePedido.tdb3.value*1) + (gradePedido.tdb4.value*1) + (gradePedido.tdb5.value*1) 
gradePedido.somatqb.value = (gradePedido.tqb1.value*1) + (gradePedido.tqb2.value*1) + (gradePedido.tqb3.value*1) + (gradePedido.tqb4.value*1) + (gradePedido.tqb5.value*1) 
gradePedido.somatsb.value = (gradePedido.tsb1.value*1) + (gradePedido.tsb2.value*1) + (gradePedido.tsb3.value*1) + (gradePedido.tsb4.value*1) + (gradePedido.tsb5.value*1) 
gradePedido.somatob.value = (gradePedido.tob1.value*1) + (gradePedido.tob2.value*1) + (gradePedido.tob3.value*1) + (gradePedido.tob4.value*1) + (gradePedido.tob5.value*1) 
gradePedido.somaqub.value = (gradePedido.qub1.value*1) + (gradePedido.qub2.value*1) + (gradePedido.qub3.value*1) + (gradePedido.qub4.value*1) + (gradePedido.qub5.value*1) 
gradePedido.somaqdb.value = (gradePedido.qdb1.value*1) + (gradePedido.qdb2.value*1) + (gradePedido.qdb3.value*1) + (gradePedido.qdb4.value*1) + (gradePedido.qdb5.value*1) 
gradePedido.somaqqb.value = (gradePedido.qqb1.value*1) + (gradePedido.qqb2.value*1) + (gradePedido.qqb3.value*1) + (gradePedido.qqb4.value*1) + (gradePedido.qqb5.value*1) 
gradePedido.somaqsb.value = (gradePedido.qsb1.value*1) + (gradePedido.qsb2.value*1) + (gradePedido.qsb3.value*1) + (gradePedido.qsb4.value*1) + (gradePedido.qsb5.value*1) 
gradePedido.somaqob.value = (gradePedido.qob1.value*1) + (gradePedido.qob2.value*1) + (gradePedido.qob3.value*1) + (gradePedido.qob4.value*1) + (gradePedido.qob5.value*1) 
gradePedido.somacib.value = (gradePedido.cib1.value*1) + (gradePedido.cib2.value*1) + (gradePedido.cib3.value*1) + (gradePedido.cib4.value*1) + (gradePedido.cib5.value*1) 
gradePedido.somacdb.value = (gradePedido.cdb1.value*1) + (gradePedido.cdb2.value*1) + (gradePedido.cdb3.value*1) + (gradePedido.cdb4.value*1) + (gradePedido.cdb5.value*1)

gradePedido.somageralb.value = 
(gradePedido.somatdb.value*1) + (gradePedido.somatqb.value*1) + (gradePedido.somatsb.value*1) + (gradePedido.somatob.value*1) + 
(gradePedido.somaqub.value*1) + (gradePedido.somaqdb.value*1) + (gradePedido.somaqqb.value*1) + (gradePedido.somaqsb.value*1) + 
(gradePedido.somaqob.value*1) + (gradePedido.somacib.value*1) + (gradePedido.somacdb.value*1)



/////// FECHAMENTO = D

gradePedido.subtotald1.value = (gradePedido.tdd1.value*1) + (gradePedido.tqd1.value*1) + (gradePedido.tsd1.value*1) + (gradePedido.tod1.value*1) + (gradePedido.qud1.value*1) + (gradePedido.qdd1.value*1) + (gradePedido.qqd1.value*1) + (gradePedido.qsd1.value*1) + (gradePedido.qod1.value*1) + (gradePedido.cid1.value*1) + (gradePedido.cdd1.value*1)
gradePedido.subtotald2.value = (gradePedido.tdd2.value*1) + (gradePedido.tqd2.value*1) + (gradePedido.tsd2.value*1) + (gradePedido.tod2.value*1) + (gradePedido.qud2.value*1) + (gradePedido.qdd2.value*1) + (gradePedido.qqd2.value*1) + (gradePedido.qsd2.value*1) + (gradePedido.qod2.value*1) + (gradePedido.cid2.value*1) + (gradePedido.cdd2.value*1)
gradePedido.subtotald3.value = (gradePedido.tdd3.value*1) + (gradePedido.tqd3.value*1) + (gradePedido.tsd3.value*1) + (gradePedido.tod3.value*1) + (gradePedido.qud3.value*1) + (gradePedido.qdd3.value*1) + (gradePedido.qqd3.value*1) + (gradePedido.qsd3.value*1) + (gradePedido.qod3.value*1) + (gradePedido.cid3.value*1) + (gradePedido.cdd3.value*1)

gradePedido.somatdd.value = (gradePedido.tdd1.value*1) + (gradePedido.tdd2.value*1) + (gradePedido.tdd3.value*1)
gradePedido.somatqd.value = (gradePedido.tqd1.value*1) + (gradePedido.tqd2.value*1) + (gradePedido.tqd3.value*1)
gradePedido.somatsd.value = (gradePedido.tsd1.value*1) + (gradePedido.tsd2.value*1) + (gradePedido.tsd3.value*1)
gradePedido.somatod.value = (gradePedido.tod1.value*1) + (gradePedido.tod2.value*1) + (gradePedido.tod3.value*1)
gradePedido.somaqud.value = (gradePedido.qud1.value*1) + (gradePedido.qud2.value*1) + (gradePedido.qud3.value*1)
gradePedido.somaqdd.value = (gradePedido.qdd1.value*1) + (gradePedido.qdd2.value*1) + (gradePedido.qdd3.value*1)
gradePedido.somaqqd.value = (gradePedido.qqd1.value*1) + (gradePedido.qqd2.value*1) + (gradePedido.qqd3.value*1)
gradePedido.somaqsd.value = (gradePedido.qsd1.value*1) + (gradePedido.qsd2.value*1) + (gradePedido.qsd3.value*1)
gradePedido.somaqod.value = (gradePedido.qod1.value*1) + (gradePedido.qod2.value*1) + (gradePedido.qod3.value*1)
gradePedido.somacid.value = (gradePedido.cid1.value*1) + (gradePedido.cid2.value*1) + (gradePedido.cid3.value*1)
gradePedido.somacdd.value = (gradePedido.cdd1.value*1) + (gradePedido.cdd2.value*1) + (gradePedido.cdd3.value*1)

gradePedido.somagerald.value = 
(gradePedido.somatdd.value*1) + (gradePedido.somatqd.value*1) + (gradePedido.somatsd.value*1) + (gradePedido.somatod.value*1) + 
(gradePedido.somaqud.value*1) + (gradePedido.somaqdd.value*1) + (gradePedido.somaqqd.value*1) + (gradePedido.somaqsd.value*1) + 
(gradePedido.somaqod.value*1) + (gradePedido.somacid.value*1) + (gradePedido.somacdd.value*1)

/////

}
</script>

<script language='JavaScript'>
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;   
    if((tecla>47 && tecla<58)) return true;
    else{
    	if (tecla==8 || tecla==0) return true;
	else  return false;
    }
}
</script>


<?php include(FOOTER_TEMPLATE); ?>
