<?php
    session_start();
	ob_start();

	$id_users = isset($_SESSION['id_users']) ? $_SESSION['id_users']: "";	
	$nome_user = isset($_SESSION['nome']) ? $_SESSION['nome']: "";	
	$email_users = isset($_SESSION['email']) ? $_SESSION['email']: "";	
	$pass_users = isset($_SESSION['pass']) ? $_SESSION['pass']: "";	
	$logado = isset($_SESSION['logado']) ? $_SESSION['logado']: "N";	

	if ($logado == "N" && $id_users == ""){	    
		echo  "<script type='text/javascript'>
					location.href='login.php'
				</script>";	
		exit();
	}

    require 'conexion.php';
    require_once('functions.php');
	include(HEADER_TEMPLATE); 
    
	$id = $_GET['id'];
	$view = $_GET['view'];	

    // seleciona todos os registros da base com inner join cliente

    $sql = "SELECT	
    companies.popular_name,
    pilotos.*,
    pilotos.id AS pilotoID,
    pedidos.*,
    pedidos.id AS pedidoID,
    pedidos.obs AS obsPed,
    DATE_FORMAT(pedidos.data_pedido, '%d/%m/%Y') AS data_pedido,
    DATE_FORMAT(pedidos.data_entrega, '%d/%m/%Y') AS data_entrega,
    ordem_corte.*,
    ordem_corte.id_oc AS ocID,
    DATE_FORMAT(
        ordem_corte.enviado_producao,
        '%d/%m/%Y %H:%i:%s'
    ) AS enviado_producao,
    producao.id_producao AS producaoID,
    DATE_FORMAT(
        producao.producao_inicio,
        '%d/%m/%Y %H:%i:%s'
    ) AS producao_inicio,
    DATE_FORMAT(
        producao.producao_fim,
        '%d/%m/%Y %H:%i:%s'
    ) AS producao_fim,
    grade.*,
    grade_fim.*,	
    grade.id_grade AS gradeID
FROM
    pedidos
INNER JOIN companies ON pedidos.nr_company = companies.id
LEFT JOIN pilotos ON pilotos.id_pedido = pedidos.id
LEFT JOIN ordem_corte ON pedidos.id = ordem_corte.id_pedido
LEFT JOIN grade ON pedidos.id = grade.id_pedido
LEFT JOIN grade_fim ON pedidos.id = grade_fim.id_pedido
LEFT JOIN producao ON ordem_corte.id_oc = producao.id_oc
WHERE
    pedidos.id = '$id'";

    $resultado = $mysqli->query($sql);
    $row = $resultado->fetch_array(MYSQLI_ASSOC);
	
	$totalizacaoGrade = (int)$row['somagerala'];
	
	$id_Prod = $row['producaoID'];
	$id_Ped = $row['pedidoID'];
	
	$saldo = ( $row['somagerald'] - $totalizacaoGrade );
	
	$tot =	"SELECT
			id_producao,
			setor,
			SUM(qtd) AS totalg
		FROM
				`apontamentos`
		WHERE
				apontamentos.id_producao = '$id_Prod' AND ativo = '1'
		GROUP BY
				setor
		ORDER BY
				setor";		
//echo $sql;				
?>									
	
			<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: #67ad99" align="center">  
                                <td><span style='font-weight:bold;'>*** VISUALZAÇÃO DETALHADA - ORDEM DE CORTE Nr: <?php echo $row['id_oc'] ?>  |   PEDIDO Nr: <?php echo $row['id'].' ' ?> ***</span></td>  
                            </tr>  
                        </thead>  
                    </table>
					<?php IF ( (int)$row['producao_fim'] > 0 ) { ?>
						<div class="alert alert-danger" align="center">
							<strong>*** PRODUÇÃO CONCLUÍDA ***</strong>
						</div>
					<?php } ?>    	
                    <ul class="nav nav-tabs">
					<?php
						$pilz  = ''; $pilx  = ' class="tab-pane fade"'; 
						$pedz  = ''; $pedx  = ' class="tab-pane fade"'; 
						$ocz   = ''; $ocx   = ' class="tab-pane fade"'; 
						$prodz = ''; $prodx = ' class="tab-pane fade"'; 
						$apoz  = ''; $apox  = ' class="tab-pane fade"'; 
						$fimz  = ''; $fimx  = ' class="tab-pane fade"';
						
						switch ($view) {
							case 'piloto':
								$pilz = 'class="active"';
								$pilx = ' class="tab-pane fade in active"';								
								break;
							case 'pedido':
								$pedz = 'class="active"';
								$pedx = ' class="tab-pane fade in active"';									
								break;
							case 'oc':
								$ocz = 'class="active"';
								$ocx = ' class="tab-pane fade in active"';									
								break;
							case 'prod':
								$prodz = 'class="active"';
								$prodx = ' class="tab-pane fade in active"';									
								break;
							case 'apontamento':
								$apoz = 'class="active"';
								$apox = ' class="tab-pane fade in active"';									
								break;								
							case 'apontamento2':
								$apoz = 'class="active"';
								$apox = ' class="tab-pane fade in active"';									
								break;
							case 'fim':
								$fimz = 'class="active"';
								$fimx = ' class="tab-pane fade in active"';									
								break;								
						}
						?>					
                        <li <?php echo $pilz ?>><a data-toggle="tab" href="#piloto">PILOTO</a></li>
                        <li <?php echo $pedz ?>><a data-toggle="tab" href="#home">PEDIDO</a></li>
                        <li><a data-toggle="tab" href="#menu1">GRADE DO PEDIDO</a></li>
                        <li <?php echo $ocz ?>><a data-toggle="tab" href="#menu2">RISCOS</a></li>
                        <li><a data-toggle="tab" href="#menu3">FORRO</a></li>
                        <li <?php echo $prodz ?>><a data-toggle="tab" href="#menu4">STATUS DE PRODUÇÃO</a></li>										
                        <li <?php echo $fimz ?>><a data-toggle="tab" href="#menu6">FINALIZAÇÃO</a></li>
                        <li <?php echo $apoz ?>><a data-toggle="tab" href="#menu5">APONTAMENTOS</a></li>								
                    </ul>
                    <div class="tab-content">
                        <div id="piloto" <?php echo $pilx ?>>
                            <br>
							<div class="row">
								<div class="form-group col-md-1">
									<label for="lacre">Lacre</label>
									<input type="text" class="form-control" id="lacre" name="lacre" value="<?php echo $row['lacre']; ?>" readonly="readonly">
								</div>                        

								<div class="form-group col-md-2">
									<label for="stdate">Data de Cadastro</label>
									<input type="date" class="form-control" name="stdate" id="stdate" value="<?php echo $row['stdate'] ?>" readonly="readonly">
								</div>

								<div class="form-group col-md-5">
								  <label for="dlvdate">Cliente</label>
									<input type="text" class="form-control" id="nr_company" name="nr_company" value="<?php echo $row['popular_name']; ?>" readonly="readonly">                      
								</div>

								<div class="form-group col-md-2">
									<label for="reference">Referência</label>
									<input type="text" class="form-control" id="reference" name="reference" placeholder="Informe a referência" value="<?php echo $row['reference']; ?>" 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>

							<div class="row">              
								<div class="form-group col-md-2">
								  <label for="model">Modelo</label>
									<input type="text" class="form-control" id="model" name="model" value="<?php echo $row['model']; ?>" readonly="readonly">                      
								</div>
							
								<div class="form-group col-md-4">
									<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-3">
									<label for="colors">Cores</label>
									<input type="text" class="form-control" id="colors" name="colors" value="<?php echo $row['colors']; ?>" readonly="readonly">
								</div>

								<div class="form-group col-md-3">
									<label for="linha">Linha</label>
									<input type="text" class="form-control" id="linha" name="linha" value="<?php echo $row['linha']; ?>" readonly="readonly">
								</div>
								
								
							</div> 
							<div class="row">
								<div class="form-group col-md-2">
								  <label for="dlvdate">Data de Entrega</label>
									<input type="date" class="form-control" id="dlvdate" name="dlvdate" value="<?php echo $row['dlvdate']; ?>" readonly="readonly">                      
								</div>
							   
								<div class="form-group col-md-2">
									<label for="approvedby">Aprovado por</label>
									<input type="text" class="form-control" id="approvedby" name="approvedby" value="<?php echo $row['approvedby']; ?>" readonly="readonly">
								</div>
								
								<div class="form-group col-md-2">
								  <label for="dtapproved">Data da Aprovação</label>
									<input type="date" class="form-control" id="dtapproved" name="dtapproved" value="<?php echo $row['dtapproved']; ?>" readonly="readonly">                          
								</div>

								<div class="form-group col-md-2">
									<label for="value">Valor</label>
									<input type="text" class="form-control" id="value" name="value" value="<?php echo $row['value']; ?>" readonly="readonly">
								</div>
								<div class="form-group col-md-2">
									<label for="ativo">Piloto ATIVO?</label>
									
									<div class="form-group">
										
										<label class="radio-inline  col-md-3">
											<input type="text" id="ativo" name="ativo" value="<?php echo $row['ativo']; ?>" readonly="readonly">
										</label>
									</div> 
								</div>

							</div>

							<div class="row">

								<div class="form-group col-sm-12 control-label">
									<label for="obs">Observações do PILOTO</label>
									<div class="">
										<textarea name="obs" class="form-control" rows="4" cols="70" readonly="readonly"><?php echo $row['obs']?></textarea>
									</div>
								</div>

							</div> 		
                        </div>					
                        <div id="home" <?php echo $pedx ?>>
                            <br>
                            <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="lacre" id="lacre" value="<?php echo $row['lacre'] ?>" readonly="readonly">
                                </div>

                                <div class="form-group col-md-2">
                                    <label for="nr_pedido">Nr Pedido</label>
                                    <input type="text" 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="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-4">
                                    <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-sm-6 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>
                        <div id="menu1" class="tab-pane fade">    
                        <br>                          
                            
                            <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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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="font-weight:bold">  
                                       <td width="10%">
                                            <input type="text" size ="15" width="1" maxlength="15" style='text-transform:uppercase' value="<?php echo $row['tituloc4'] ?>" id="tituloc4" name="tituloc4" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdc4" name="tdc4" value="<?php echo $row['tdc4'] > 0 ? $row['tdc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td> 
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqc4" name="tqc4" value="<?php echo $row['tqc4'] > 0 ? $row['tqc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsc4" name="tsc4" value="<?php echo $row['tsc4'] > 0 ? $row['tsc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toc4" name="toc4" value="<?php echo $row['toc4'] > 0 ? $row['toc4'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="quc4" name="quc4" value="<?php echo $row['quc4'] > 0 ? $row['quc4'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdc4" name="qdc4" value="<?php echo $row['qdc4'] > 0 ? $row['qdc4'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqc4" name="qqc4" value="<?php echo $row['qqc4'] > 0 ? $row['qqc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsc4" name="qsc4" value="<?php echo $row['qsc4'] > 0 ? $row['qsc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoc4" name="qoc4" value="<?php echo $row['qoc4'] > 0 ? $row['qoc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cic4" name="cic4" value="<?php echo $row['cic4'] > 0 ? $row['cic4'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdc4" name="cdc4" value="<?php echo $row['cdc4'] > 0 ? $row['cdc4'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalc4" name="subtotalc4" 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['tituloc5'] ?>" id="tituloc5" name="tituloc5" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdc5" name="tdc5" value="<?php echo $row['tdc5'] > 0 ? $row['tdc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td> 
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqc5" name="tqc5" value="<?php echo $row['tqc5'] > 0 ? $row['tqc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsc5" name="tsc5" value="<?php echo $row['tsc5'] > 0 ? $row['tsc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="toc5" name="toc5" value="<?php echo $row['toc5'] > 0 ? $row['toc5'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="quc5" name="quc5" value="<?php echo $row['quc5'] > 0 ? $row['quc5'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdc5" name="qdc5" value="<?php echo $row['qdc5'] > 0 ? $row['qdc5'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqc5" name="qqc5" value="<?php echo $row['qqc5'] > 0 ? $row['qqc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsc5" name="qsc5" value="<?php echo $row['qsc5'] > 0 ? $row['qsc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qoc5" name="qoc5" value="<?php echo $row['qoc5'] > 0 ? $row['qoc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cic5" name="cic5" value="<?php echo $row['cic5'] > 0 ? $row['cic5'] : '';  ?>" readonly="readonly" >
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdc5" name="cdc5" value="<?php echo $row['cdc5'] > 0 ? $row['cdc5'] : '';  ?>" readonly="readonly" >  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotalc5" name="subtotalc5" 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="somatdcx" name="somatdcx" value="<?php echo $row['somatdc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td> 
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqcx" name="somatqcx" value="<?php echo $row['somatqc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatscx" name="somatscx" value="<?php echo $row['somatsc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatocx" name="somatocx" value="<?php echo $row['somatoc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqucx" name="somaqucx" value="<?php echo $row['somaquc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdcx" name="somaqdcx" value="<?php echo $row['somaqdc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqcx" name="somaqqcx" value="<?php echo $row['somaqqc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqscx" name="somaqscx" value="<?php echo $row['somaqsc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqocx" name="somaqocx" value="<?php echo $row['somaqoc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacicx" name="somacicx" value="<?php echo $row['somacic'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdcx" name="somacdcx" value="<?php echo $row['somacdc'] ?>" readonly="readonly">  
                                       </td>  
                                       <td>  
                                            <input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageralcx" name="somageralcx" value="<?php echo $row['somageralc'] ?>" readonly="readonly">  
                                       </td>     
                                   </tr>  
                                </table>
                            </div>
                        </div>
						<div id="menu2" <?php echo $ocx ?>>
							<br>
							<table id="gradeOCcortes" class="table table-striped table-condensed table-bordered">  
								<a href="pdf_oc_view.php?id=<?php echo $id_Ped; ?>" target="_blank"">Visualiza PDF</a>
								<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="background-color: #96928f">  
								   <td width="10%">
									Somatória PEDIDO
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdc" name="somatdc" value="<?php echo $row['somatdc'] ?>" readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqc" name="somatqc" value="<?php echo $row['somatqc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsc" name="somatsc" value="<?php echo $row['somatsc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoc" name="somatoc" value="<?php echo $row['somatoc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaquc" name="somaquc" value="<?php echo $row['somaquc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdc" name="somaqdc" value="<?php echo $row['somaqdc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqc" name="somaqqc" value="<?php echo $row['somaqqc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsc" name="somaqsc" value="<?php echo $row['somaqsc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoc" name="somaqoc" value="<?php echo $row['somaqoc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacic" name="somacic" value="<?php echo $row['somacic'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdc" name="somacdc" value="<?php echo $row['somacdc'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageralc" name="somageralc" value="<?php echo $row['somageralc'] ?>" readonly="readonly">  
								   </td>     
							   </tr>  

								<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' required 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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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%">
									(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>
						</div>
						<div id="menu3" class="tab-pane fade">                               
							<br>
							<table id="gradeOCcortes" class="table table-striped table-condensed table-bordered">  
								<a href="pdf_oc_view.php?id=<?php echo $id_Ped; ?>" target="_blank" ">Visualiza PDF</a>
								<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="background-color: #96928f">  
								   <td width="10%">
									Somatória RISCOS
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdax" name="somatdax" readonly="readonly" >  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqax" name="somatqax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsax" name="somatsax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoax" name="somatoax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaquax" name="somaquax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdax" name="somaqdax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqax" name="somaqqax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsax" name="somaqsax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoax" name="somaqoax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaciax" name="somaciax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdax" name="somacdax" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageralax" name="somageralax" readonly="readonly">  
								   </td>     
								</tr>                                   

								<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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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'] > 0 ? $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> 
								<tr align="center" style="background-color: #96928f">  
								   <td width="10%">
									(RISCOS x FORRO)
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatdadifx" name="somatdadifx" readonly="readonly" ></p>
								   </td>  
								   <td> 
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqadifx" name="somatqadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsadifx" name="somatsadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatoadifx" name="somatoadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaquadifx" name="somaquadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdadifx" name="somaqdadifx" readonly="readonly"></p> 
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqadifx" name="somaqqadifx" readonly="readonly"></p>
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsadifx" name="somaqsadifx" readonly="readonly"></p> 
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqoadifx" name="somaqoadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaciadifx" name="somaciadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdadifx" name="somacdadifx" readonly="readonly"></p>  
								   </td>  
								   <td>  
										<p style="color:red;"><input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somageraladifx" name="somageraladifx" readonly="readonly"></p>  
								   </td>     
								</tr>  
							   
							</table>
						</div>
						<div id="menu4" <?php echo $prodx ?>>
						<br>
							<div class="container-fluid">

								<div class="row">

								</div>			
								<div class="col-sm-6" style="background-color:WhiteSmoke;">
								<br>
									<div class="row">	
											<div class="form-group col-md-10">
												<label for="popular_name">Cliente</label>
												<input type="text" class="form-control" name="popular_name" id="popular_name" value="<?php echo $row['popular_name'] ?>" readonly="readonly">
											</div>		
									</div>							<div class="row">	
											<div class="form-group col-md-3">
												<label for="producaoID">Nr Produção</label>
												<input type="text" class="form-control" name="producaoID" id="producaoID" value="<?php echo $row['producaoID'] ?>" readonly="readonly">
											</div>		
											<div class="form-group col-md-4">
												<label for="oc">Ordem de Corte</label>
												<input type="text" class="form-control" name="oc" id="oc" value="<?php echo $row['ocID'] ?>" readonly="readonly">
											</div>								
											<div class="form-group col-md-3">
												<label for="pedido">Nr Pedido</label>
												<input type="text" class="form-control" name="pedido" id="pedido" value="<?php echo $row['pedidoID'] ?>" readonly="readonly">
											</div>
									</div>						
									<div class="row">				
											<div class="form-group col-md-3">
												<label for="meta">Meta Produção</label>
												<input type="text" class="form-control" name="meta" id="meta" value="<?php echo $totalizacaoGrade ?>" readonly="readonly">
											</div>						
											<div class="form-group col-md-3">
												<label for="somagerald">Produzido</label>
												<input type="text" class="form-control" name="somagerald" id="somagerald" value="<?php echo $row['somagerald'] ?>" readonly="readonly">
											</div>						
											<div class="form-group col-md-2">
												<label for="sd">Saldo</label>
												<input type="text" class="form-control" name="sd" id="sd" value="<?php echo $saldo ?>" readonly="readonly">
											</div>						
											<div class="form-group col-md-1">
												<label for="sds"></label>
												<a href="pdf_oc_view.php?id=<?php echo $id_Ped; ?>" target="_blank" "><button type="button" class="btn btn-xs btn-default" >Folha O.C.</button></a>
											</div>						

									</div>						
									<div class="row">				
											<div class="form-group col-md-5">
												<label for="data_pedido">Data do PEDIDO</label>
												<input type="text" class="form-control" name="data_pedido" id="data_pedido" value="<?php echo $row['data_pedido'] ?>" readonly="readonly">
											</div>
											<div class="form-group col-md-5">
												<label for="data_entrega">Data da Entrega no Pedido</label>
												<input type="text" class="form-control" name="data_entrega" id="data_entrega" value="<?php echo $row['data_entrega'] ?>" readonly="readonly">
											</div>						
									</div>						
									<div class="row">				
											<div class="form-group col-md-10">
												<label for="enviado_producao">O.C. enviou para Produção em:</label>
												<input type="text" class="form-control" name="enviado_producao" id="enviado_producao" value="<?php echo $row['enviado_producao'] ?>" readonly="readonly">
											</div>						
									</div>						
									<div class="row">				
											<div class="form-group col-md-5">
												<label for="producao_inicio">Início da Produção</label>
												<input type="text" class="form-control" name="producao_inicio" id="producao_inicio" value="<?php echo $row['producao_inicio'] ?>" readonly="readonly">
											</div>
											<div class="form-group col-md-5">
												<label for="producao_fim">Fim da Produção</label>
												<input type="text" class="form-control" name="producao_fim" id="producao_fim" value="<?php echo $row['producao_fim'] ?>" readonly="readonly">
											</div>						
									</div>						
								</div>
								<div class="col-sm-1">
								</div>			
								<div class="col-sm-5" style="background-color:WhiteSmoke;">
									<div class="row">				
										<table class="table table-hover">

											<thead>
											  <tr>
											  </tr>
											</thead>

											<tbody>
											
												<?php 							
												$resultadoTot = $mysqli->query($tot);
												while($row2 = $resultadoTot->fetch_array(MYSQLI_ASSOC)) { 
												$progresso =  ( ($row2['totalg'] * 100) / ($totalizacaoGrade) );

												switch ($progresso) {
													case ($progresso <= 25);
														$res = "progress-bar progress-bar-danger";
													break;
													
													case ($progresso > 26) && ($progresso < 50);
														$res = "progress-bar progress-bar-warning";
													break;
														
													case ($progresso > 50) && ($progresso < 75);
														$res = "progress-bar progress-bar-info";
													break;
													
													default;
														$res = "progress-bar progress-bar-success";
												   
												}
												?>
													<tr>
														<td> <?php echo $row2['setor']; ?> - <?php echo $row2['totalg']; ?> de <?php echo $totalizacaoGrade;?> ( <?php echo ( $row2['totalg'] - $totalizacaoGrade ); ?> ) 	

															<div class="progress">
																<div class="<?php echo $res ?>" role="progressbar" aria-valuenow="<?php echo $progresso ?>" 
																aria-valuemin="0" aria-valuemax="100" style="width:<?php echo round($progresso) ?>%">
																<?php echo round($progresso) ?>%
																</div>
															</div>            
														</td>
													</tr>

												<?php } ?>
											</tbody>
										</table>
									</div>
								</div>
							</div>								
						</div>
						<div id="menu6" <?php echo $fimx ?>>
							<br>
							<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;'>Finalização</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'] ?>" readonly="readonly" >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd1" name="tdd1" value="<?php echo $row['tdd1'] ?>" readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd1" name="tqd1" value="<?php echo $row['tqd1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd1" name="tsd1" value="<?php echo $row['tsd1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod1" name="tod1" value="<?php echo $row['tod1'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud1" name="qud1" value="<?php echo $row['qud1'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd1" name="qdd1" value="<?php echo $row['qdd1'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd1" name="qqd1" value="<?php echo $row['qqd1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd1" name="qsd1" value="<?php echo $row['qsd1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod1" name="qod1" value="<?php echo $row['qod1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid1" name="cid1" value="<?php echo $row['cid1'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd1" name="cdd1" value="<?php echo $row['cdd1'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald1" name="subtotald1" value="<?php echo $row['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" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd2" name="tdd2" value="<?php echo $row['tdd2'] ?>" readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd2" name="tqd2" value="<?php echo $row['tqd2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd2" name="tsd2" value="<?php echo $row['tsd2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod2" name="tod2" value="<?php echo $row['tod2'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud2" name="qud2" value="<?php echo $row['qud2'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd2" name="qdd2" value="<?php echo $row['qdd2'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd2" name="qqd2" value="<?php echo $row['qqd2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd2" name="qsd2" value="<?php echo $row['qsd2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod2" name="qod2" value="<?php echo $row['qod2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid2" name="cid2" value="<?php echo $row['cid2'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd2" name="cdd2" value="<?php echo $row['cdd2'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald2" name="subtotald2" value="<?php echo $row['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" readonly="readonly"  >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd3" name="tdd3" value="<?php echo $row['tdd3'] ?>"readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd3" name="tqd3" value="<?php echo $row['tqd3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd3" name="tsd3" value="<?php echo $row['tsd3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod3" name="tod3" value="<?php echo $row['tod3'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud3" name="qud3" value="<?php echo $row['qud3'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd3" name="qdd3" value="<?php echo $row['qdd3'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd3" name="qqd3" value="<?php echo $row['qqd3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd3" name="qsd3" value="<?php echo $row['qsd3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod3" name="qod3" value="<?php echo $row['qod3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid3" name="cid3" value="<?php echo $row['cid3'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd3" name="cdd3" value="<?php echo $row['cdd3'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald3" name="subtotald3" value="<?php echo $row['subtotald3'] ?>" 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['titulod4'] ?>" id="titulod4" name="titulod4" readonly="readonly"  >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd4" name="tdd4" value="<?php echo $row['tdd4'] ?>"readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd4" name="tqd4" value="<?php echo $row['tqd4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd4" name="tsd4" value="<?php echo $row['tsd4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod4" name="tod4" value="<?php echo $row['tod4'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud4" name="qud4" value="<?php echo $row['qud4'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd4" name="qdd4" value="<?php echo $row['qdd4'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd4" name="qqd4" value="<?php echo $row['qqd4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd4" name="qsd4" value="<?php echo $row['qsd4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod4" name="qod4" value="<?php echo $row['qod4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid4" name="cid4" value="<?php echo $row['cid4'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd4" name="cdd4" value="<?php echo $row['cdd4'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald4" name="subtotald4" value="<?php echo $row['subtotald4'] ?>" 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['titulod5'] ?>" id="titulod5" name="titulod5" readonly="readonly"  >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd5" name="tdd5" value="<?php echo $row['tdd5'] ?>"readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd5" name="tqd5" value="<?php echo $row['tqd5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd5" name="tsd5" value="<?php echo $row['tsd5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod5" name="tod5" value="<?php echo $row['tod5'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud5" name="qud5" value="<?php echo $row['qud5'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd5" name="qdd5" value="<?php echo $row['qdd5'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd5" name="qqd5" value="<?php echo $row['qqd5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd5" name="qsd5" value="<?php echo $row['qsd5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod5" name="qod5" value="<?php echo $row['qod5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid5" name="cid5" value="<?php echo $row['cid5'] ?>" readonly="readonly">
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd5" name="cdd5" value="<?php echo $row['cdd5'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald5" name="subtotald5" value="<?php echo $row['subtotald5'] ?>" 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['titulod6'] ?>" id="titulod6" name="titulod6" readonly="readonly"  >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd6" name="tdd6" value="<?php echo $row['tdd6'] ?>"readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd6" name="tqd6" value="<?php echo $row['tqd6'] ?>" readonly="readonly">  
								   </td>                                                                                                   
								   <td>                                                                                                   
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd6" name="tsd6" value="<?php echo $row['tsd6'] ?>" readonly="readonly">  
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod6" name="tod6" value="<?php echo $row['tod6'] ?>" readonly="readonly">
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud6" name="qud6" value="<?php echo $row['qud6'] ?>" readonly="readonly">
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd6" name="qdd6" value="<?php echo $row['qdd6'] ?>" readonly="readonly">
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd6" name="qqd6" value="<?php echo $row['qqd6'] ?>" readonly="readonly">  
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd6" name="qsd6" value="<?php echo $row['qsd6'] ?>" readonly="readonly">  
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod6" name="qod6" value="<?php echo $row['qod6'] ?>" readonly="readonly">  
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid6" name="cid6" value="<?php echo $row['cid6'] ?>" readonly="readonly">
								   </td>                                                                                                   
								   <td>                                                                                                    
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd6" name="cdd6" value="<?php echo $row['cdd6'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald6" name="subtotald6" value="<?php echo $row['subtotald6'] ?>" 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['titulod7'] ?>" id="titulod7" name="titulod7" readonly="readonly"  >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="tdd7" name="tdd7" value="<?php echo $row['tdd7'] ?>"readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tqd7" name="tqd7" value="<?php echo $row['tqd7'] ?>" readonly="readonly">  
								   </td>                                                                                       
								   <td>                                                                                        
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tsd7" name="tsd7" value="<?php echo $row['tsd7'] ?>" readonly="readonly">  
								   </td>                                                                                    
								   <td>                                                                                     
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="tod7" name="tod7" value="<?php echo $row['tod7'] ?>" readonly="readonly">
								   </td>                                                                                      
								   <td>                                                                                       
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qud7" name="qud7" value="<?php echo $row['qud7'] ?>" readonly="readonly">
								   </td>                                                                                      
								   <td>                                                                                       
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qdd7" name="qdd7" value="<?php echo $row['qdd7'] ?>" readonly="readonly">
								   </td>                                                                                 
								   <td>                                                                                  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qqd7" name="qqd7" value="<?php echo $row['qqd7'] ?>" readonly="readonly">  
								   </td>                                                                                     
								   <td>                                                                                      
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qsd7" name="qsd7" value="<?php echo $row['qsd7'] ?>" readonly="readonly">  
								   </td>                                                                              
								   <td>                                                                               
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="qod7" name="qod7" value="<?php echo $row['qod7'] ?>" readonly="readonly">  
								   </td>                                                                                 
								   <td>                                                                                  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cid7" name="cid7" value="<?php echo $row['cid7'] ?>" readonly="readonly">
								   </td>                                                                               
								   <td>                                                                                
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="cdd7" name="cdd7" value="<?php echo $row['cdd7'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3" style="text-align:center;" id="subtotald7" name="subtotald7" value="<?php echo $row['subtotald7'] ?>" 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="somatdd" name="somatdd" value="<?php echo $row['somatdd'] ?>" readonly="readonly">  
								   </td>  
								   <td> 
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatqd" name="somatqd" value="<?php echo $row['somatqd'] ?>" readonly="readonly" >  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatsd" name="somatsd" value="<?php echo $row['somatsd'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somatod" name="somatod" value="<?php echo $row['somatod'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqud" name="somaqud" value="<?php echo $row['somaqud'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqdd" name="somaqdd" value="<?php echo $row['somaqdd'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqqd" name="somaqqd" value="<?php echo $row['somaqqd'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqsd" name="somaqsd" value="<?php echo $row['somaqsd'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somaqod" name="somaqod" value="<?php echo $row['somaqod'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacid" name="somacid" value="<?php echo $row['somacid'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somacdd" name="somacdd" value="<?php echo $row['somacdd'] ?>" readonly="readonly">  
								   </td>  
								   <td>  
										<input type="text" size ="3" width="1" maxlength="3"  style="text-align:center;" id="somagerald" name="somagerald" readonly="readonly" value="<?php echo $row['somagerald'] ?>">  
								   </td>     
							   </tr>                                   
							</table>    
						</div>
						
						<div id="menu5" <?php echo $apox ?>>
									<br>
						
							<table id="mitabla" class="table table-condensed table-bordered">
								<thead>
									<tr>
										<th>ID</th>
										<th>Apontador</th>								
										<th>Registro</th>                        
										<th>Setor</th>
										<th>QTD</th>
										<th>Obs</th>
										<th></th>

									</tr>
								</thead>
								
								<tbody>
									<?php 
									$apt = "SELECT apontamentos.*, DATE_FORMAT(apontamentos.registro, '%d/%m/%Y %H:%i:%s') AS registro, producao.producao_fim FROM apontamentos INNER JOIN producao ON apontamentos.id_producao = producao.id_producao WHERE apontamentos.id_producao = '$id_Prod'  AND apontamentos.ativo = '1' ORDER by apontamentos.idApontamento DESC";
									$resul = $mysqli->query($apt);
									while($row2 = $resul->fetch_array(MYSQLI_ASSOC)) { ?>
										<tr>
											<td><?php echo $row2['idApontamento']; ?></td>
											<td align="left"><?php echo $row2['apontador']; ?></td>
											<td align="left"><?php echo $row2['registro']; ?></td>
											<td align="left"><?php echo $row2['setor']; ?></td>
											<td align="right"><?php echo $row2['qtd']; ?></td>
											<td><?php echo $row2['obs']; ?></td>	
											<td><span class="glyphicon glyphicon-ban-circle" disabled></span></td>	
								
										</tr>
									<?php } ?>
								</tbody>
							</table>
						</div>			
						<form class="navbar-form">
							<div class=text-left>						
								<?php
									switch ($view) {
										case 'piloto':
											$voltar = 'piloto_index.php';						
											break;
										case 'pedido':
											$voltar = 'pedido_index.php';											
											break;
										case 'oc':
											$voltar = 'oc_index.php';												
											break;
										case 'prod':
											$voltar = 'oc_index.php';													
											break;
										case 'apontamento':
											$voltar = 'apontamento_index.php?id=' . $id;												
											break;
										case 'apontamento2':
											$voltar = 'apontamento_index.php?id=';												
											break;
										case 'fim':
											$voltar = 'apontamento_index.php';										
											break;								
									}
								?>							

									<a href="<?php echo $voltar ?>" class="btn btn-primary">Voltar</a>                            
							</div>
						</form>	
					</div>  
				</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.subtotalc4.value = (gradePedido.tdc4.value*1) + (gradePedido.tqc4.value*1) + (gradePedido.tsc4.value*1) + (gradePedido.toc4.value*1) + (gradePedido.quc4.value*1) + (gradePedido.qdc4.value*1) + (gradePedido.qqc4.value*1) + (gradePedido.qsc4.value*1) + (gradePedido.qoc4.value*1) + (gradePedido.cic4.value*1) + (gradePedido.cdc4.value*1)
gradePedido.subtotalc5.value = (gradePedido.tdc5.value*1) + (gradePedido.tqc5.value*1) + (gradePedido.tsc5.value*1) + (gradePedido.toc5.value*1) + (gradePedido.quc5.value*1) + (gradePedido.qdc5.value*1) + (gradePedido.qqc5.value*1) + (gradePedido.qsc5.value*1) + (gradePedido.qoc5.value*1) + (gradePedido.cic5.value*1) + (gradePedido.cdc5.value*1)

gradePedido.somatdc.value = (gradePedido.tdc1.value*1) + (gradePedido.tdc2.value*1) + (gradePedido.tdc3.value*1) + (gradePedido.tdc4.value*1) + (gradePedido.tdc5.value*1)
gradePedido.somatqc.value = (gradePedido.tqc1.value*1) + (gradePedido.tqc2.value*1) + (gradePedido.tqc3.value*1) + (gradePedido.tqc4.value*1) + (gradePedido.tqc5.value*1)
gradePedido.somatsc.value = (gradePedido.tsc1.value*1) + (gradePedido.tsc2.value*1) + (gradePedido.tsc3.value*1) + (gradePedido.tsc4.value*1) + (gradePedido.tsc5.value*1)
gradePedido.somatoc.value = (gradePedido.toc1.value*1) + (gradePedido.toc2.value*1) + (gradePedido.toc3.value*1) + (gradePedido.toc4.value*1) + (gradePedido.toc5.value*1)
gradePedido.somaquc.value = (gradePedido.quc1.value*1) + (gradePedido.quc2.value*1) + (gradePedido.quc3.value*1) + (gradePedido.quc4.value*1) + (gradePedido.quc5.value*1)
gradePedido.somaqdc.value = (gradePedido.qdc1.value*1) + (gradePedido.qdc2.value*1) + (gradePedido.qdc3.value*1) + (gradePedido.qdc4.value*1) + (gradePedido.qdc5.value*1)
gradePedido.somaqqc.value = (gradePedido.qqc1.value*1) + (gradePedido.qqc2.value*1) + (gradePedido.qqc3.value*1) + (gradePedido.qqc4.value*1) + (gradePedido.qqc5.value*1)
gradePedido.somaqsc.value = (gradePedido.qsc1.value*1) + (gradePedido.qsc2.value*1) + (gradePedido.qsc3.value*1) + (gradePedido.qsc4.value*1) + (gradePedido.qsc5.value*1)
gradePedido.somaqoc.value = (gradePedido.qoc1.value*1) + (gradePedido.qoc2.value*1) + (gradePedido.qoc3.value*1) + (gradePedido.qoc4.value*1) + (gradePedido.qoc5.value*1)
gradePedido.somacic.value = (gradePedido.cic1.value*1) + (gradePedido.cic2.value*1) + (gradePedido.cic3.value*1) + (gradePedido.cic4.value*1) + (gradePedido.cic5.value*1)
gradePedido.somacdc.value = (gradePedido.cdc1.value*1) + (gradePedido.cdc2.value*1) + (gradePedido.cdc3.value*1) + (gradePedido.cdc4.value*1) + (gradePedido.cdc5.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 PEDIDO 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
///// devolvendo os valores para somatoria

gradePedido.somatdax.value = (gradePedido.somatda.value*1)
gradePedido.somatqax.value = (gradePedido.somatqa.value*1)
gradePedido.somatsax.value = (gradePedido.somatsa.value*1)
gradePedido.somatoax.value = (gradePedido.somatoa.value*1)
gradePedido.somaquax.value = (gradePedido.somaqua.value*1)
gradePedido.somaqdax.value = (gradePedido.somaqda.value*1)
gradePedido.somaqqax.value = (gradePedido.somaqqa.value*1)
gradePedido.somaqsax.value = (gradePedido.somaqsa.value*1)
gradePedido.somaqoax.value = (gradePedido.somaqoa.value*1)
gradePedido.somaciax.value = (gradePedido.somacia.value*1)
gradePedido.somacdax.value = (gradePedido.somacda.value*1)


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)

///// DIFERENÇA RISCOS X FORRO
gradePedido.somatdadifx.value = (gradePedido.somatdb.value*1) - (gradePedido.somatdax.value*1)
gradePedido.somatqadifx.value = (gradePedido.somatqb.value*1) - (gradePedido.somatqax.value*1)
gradePedido.somatsadifx.value = (gradePedido.somatsb.value*1) - (gradePedido.somatsax.value*1)
gradePedido.somatoadifx.value = (gradePedido.somatob.value*1) - (gradePedido.somatoax.value*1)
gradePedido.somaquadifx.value = (gradePedido.somaqub.value*1) - (gradePedido.somaquax.value*1) 
gradePedido.somaqdadifx.value = (gradePedido.somaqdb.value*1) - (gradePedido.somaqdax.value*1)
gradePedido.somaqqadifx.value = (gradePedido.somaqqb.value*1) - (gradePedido.somaqqax.value*1)
gradePedido.somaqsadifx.value = (gradePedido.somaqsb.value*1) - (gradePedido.somaqsax.value*1)
gradePedido.somaqoadifx.value = (gradePedido.somaqob.value*1) - (gradePedido.somaqoax.value*1)
gradePedido.somaciadifx.value = (gradePedido.somacib.value*1) - (gradePedido.somaciax.value*1)
gradePedido.somacdadifx.value = (gradePedido.somacdb.value*1) - (gradePedido.somacdax.value*1)

gradePedido.somageralax.value = gradePedido.somagerala.value
///// nao mexer mais 

gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.value*1)
gradePedido.somageraladifx.value = (gradePedido.somageralb.value*1) - (gradePedido.somageralax.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.subtotald4.value = (gradePedido.tdd4.value*1) + (gradePedido.tqd4.value*1) + (gradePedido.tsd4.value*1) + (gradePedido.tod4.value*1) + (gradePedido.qud4.value*1) + (gradePedido.qdd4.value*1) + (gradePedido.qqd4.value*1) + (gradePedido.qsd4.value*1) + (gradePedido.qod4.value*1) + (gradePedido.cid4.value*1) + (gradePedido.cdd4.value*1)
gradePedido.subtotald5.value = (gradePedido.tdd5.value*1) + (gradePedido.tqd5.value*1) + (gradePedido.tsd5.value*1) + (gradePedido.tod5.value*1) + (gradePedido.qud5.value*1) + (gradePedido.qdd5.value*1) + (gradePedido.qqd5.value*1) + (gradePedido.qsd5.value*1) + (gradePedido.qod5.value*1) + (gradePedido.cid5.value*1) + (gradePedido.cdd5.value*1)

gradePedido.somatdd.value = (gradePedido.tdd1.value*1) + (gradePedido.tdd2.value*1) + (gradePedido.tdd3.value*1) + (gradePedido.tdd4.value*1) + (gradePedido.tdd5.value*1)
gradePedido.somatqd.value = (gradePedido.tqd1.value*1) + (gradePedido.tqd2.value*1) + (gradePedido.tqd3.value*1) + (gradePedido.tqd4.value*1) + (gradePedido.tqd5.value*1)
gradePedido.somatsd.value = (gradePedido.tsd1.value*1) + (gradePedido.tsd2.value*1) + (gradePedido.tsd3.value*1) + (gradePedido.tsd4.value*1) + (gradePedido.tsd5.value*1)
gradePedido.somatod.value = (gradePedido.tod1.value*1) + (gradePedido.tod2.value*1) + (gradePedido.tod3.value*1) + (gradePedido.tod4.value*1) + (gradePedido.tod5.value*1)
gradePedido.somaqud.value = (gradePedido.qud1.value*1) + (gradePedido.qud2.value*1) + (gradePedido.qud3.value*1) + (gradePedido.qud4.value*1) + (gradePedido.qud5.value*1)
gradePedido.somaqdd.value = (gradePedido.qdd1.value*1) + (gradePedido.qdd2.value*1) + (gradePedido.qdd3.value*1) + (gradePedido.qdd4.value*1) + (gradePedido.qdd5.value*1)
gradePedido.somaqqd.value = (gradePedido.qqd1.value*1) + (gradePedido.qqd2.value*1) + (gradePedido.qqd3.value*1) + (gradePedido.qqd4.value*1) + (gradePedido.qqd5.value*1)
gradePedido.somaqsd.value = (gradePedido.qsd1.value*1) + (gradePedido.qsd2.value*1) + (gradePedido.qsd3.value*1) + (gradePedido.qsd4.value*1) + (gradePedido.qsd5.value*1)
gradePedido.somaqod.value = (gradePedido.qod1.value*1) + (gradePedido.qod2.value*1) + (gradePedido.qod3.value*1) + (gradePedido.qod4.value*1) + (gradePedido.qod5.value*1)
gradePedido.somacid.value = (gradePedido.cid1.value*1) + (gradePedido.cid2.value*1) + (gradePedido.cid3.value*1) + (gradePedido.cid4.value*1) + (gradePedido.cid5.value*1)
gradePedido.somacdd.value = (gradePedido.cdd1.value*1) + (gradePedido.cdd2.value*1) + (gradePedido.cdd3.value*1) + (gradePedido.cdd4.value*1) + (gradePedido.cdd5.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); ?>
