PK

ADDRLIN : /HMFS2/WEB/DTC038/v0071350.ferozo.com/public_html/administrador/tacho/
FLL :
Current File : //HMFS2/WEB/DTC038/v0071350.ferozo.com/public_html/administrador/tacho/reporte_ventaspormes_xls.asp

<!--#include file="includes/openconn.asp" -->

<!--#include file="includes/checkadmin.asp" -->


<%''Response.Buffer = TRUE
Response.CharSet = "ISO-8859-1"
Response.CodePage = 0
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=Reporte_ventaspormes.xls"

Server.ScriptTimeout = 1200%>

<html>
<meta http-equiv="Content-Type" content="charset=ISO-8859-1" />

<body>

                      <b>VENTAS INTERNET</b> 
                      <br>

                      <%dim sqlstr
                  'sqlstr="SELECT Fups.*, Usuarios.nombre, Usuarios.idusuario, Usuarios.apellido FROM Fups LEFT JOIN Usuarios ON Fups.autor = Usuarios.idusuario ORDER BY idFups DESC"
				  dim rep_mes,rep_ano
				  
				  if request("xmes") <> "" then
					  rep_mes = cint(request("xmes"))
					  rep_ano = cint(request("xano"))
					else
					  rep_mes = month(now())
					  rep_ano = year(now())
					end if
				  
				  sqlstr="SELECT * FROM Q_pedidos WHERE (pe_nombre = 'PAGADO' OR pe_nombre = 'CERRADO') AND (YEAR(ped_fechapago) = " & rep_ano & " AND MONTH(ped_fechapago) = " & rep_mes & ") ORDER BY ped_fechapago"
                  
                  rs.open sqlstr,conn,3,1
				  if rs.EOF then%>
                   No se encontraron PEDIDOS 
                <%else
						dim xcant, tot_Mercadopago, tot_Transferencia, tot_Contraentrega
						tot_Mercadopago= 0
						tot_Transferencia = 0
						tot_Contraentrega = 0
						rs.movefirst%>
                        
                      <table class="table table-bordered table-hover">
                        <thead>
                          <tr>
                            <th>Fecha</th>
                            <th>Nombre</th>
                            <th>Mercadopago</th>
                            <th>Transferencia</th>
                            <th>Contraentrega</th>
                          </tr>
                        </thead>
                        <tbody>
                          <%do until rs.EOF%>
                          <tr>
                            <td><%=rs("ped_fechapago")%></td>
                            <td><%=rs("ped_nombre")%></td>
                            <td align="right"><%if rs("ped_tipopago") = "Mercadopago" then
								tot_Mercadopago = tot_Mercadopago + rs("ped_monto")%>
                            	$ <%=rs("ped_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ped_tipopago") = "Transferencia" then
								tot_Transferencia = tot_Transferencia + rs("ped_monto")%>
                            	$ <%=rs("ped_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ped_tipopago") = "Contraentrega" then
								tot_Contraentrega = tot_Contraentrega + rs("ped_monto")%>
                            	$ <%=rs("ped_monto")%>
                                <%end if%></td>                                                             
                          </tr>
                          <%rs.movenext
					      loop%>
                        </tbody>
                        <tbody>
                          <tr>
                            <td>TOTALES INTERNET</td>
                            <td></td>
                            <td align="right">$ <%=tot_Mercadopago%></td>
                            <td align="right">$ <%=tot_Transferencia%></td>
                            <td align="right">$ <%=tot_Contraentrega%></td>
                          </tr>
                        </tbody>                        
                      </table>
                      <%end if
					  rs.close%>

<br>
<br>
<b>VENTAS SHOWROOM</b><br>

                      
                      <%sqlstr="SELECT * FROM Ventas WHERE (YEAR(ven_fechapago) = " & rep_ano & " AND MONTH(ven_fechapago) = " & rep_mes & ") OR (YEAR(ven_fechapago1) = " & rep_ano & " AND MONTH(ven_fechapago1) = " & rep_mes & ") ORDER BY ven_fechapago"
                  
                  rs.open sqlstr,conn,3,1
				  if rs.EOF then%>
                   <div class="alert alert-danger">
                    <strong>No se encontraron VENTAS EN SHOWROOM </strong>Intente nuevamente
                </div>
                
                <%else
						dim tot_Efectivo, tot_Cuenta_corriente, tot_VISA_1_PAGO, tot_VISA_3_PAGOS,tot_VISA_6_PAGOS,tot_VISA_12_PAGOS,tot_MASTERCARD_1_PAGO,tot_MASTERCARD_3_PAGOS,tot_MASTERCARD_6_PAGOS,tot_MASTERCARD_12_PAGOS,tot_VISA_ELECTRON,tot_MAESTRO
						
						tot_Efectivo = 0
						tot_Cuenta_corriente = 0
						tot_VISA_1_PAGO = 0
						tot_VISA_3_PAGOS = 0
						tot_VISA_6_PAGOS = 0
						tot_VISA_12_PAGOS = 0
						tot_MASTERCARD_1_PAGO = 0
						tot_MASTERCARD_3_PAGOS = 0
						tot_MASTERCARD_6_PAGOS = 0
						tot_MASTERCARD_12_PAGOS = 0
						tot_VISA_ELECTRON = 0
						tot_MAESTRO = 0
						rs.movefirst%>
                        
                      <table class="table table-bordered table-hover">
                        <thead>
                          <tr>
                            <th>Fecha</th>
                            <th>Nombre</th>
                            <th>Efectivo</th>
                            <th>Cuenta corriente</th>
                            <th>VISA 1 PAGO</th>
                            <th>VISA 3 PAGOS</th>
                            <th>VISA 6 PAGOS</th>
                            <th>VISA 12 PAGOS</th>
                            <th>MASTERCARD 1 PAGO</th>
                            <th>MASTERCARD 3 PAGOS</th>
                            <th>MASTERCARD 6 PAGOS</th>
                            <th>MASTERCARD 12 PAGOS</th>
                            <th>VISA ELECTRON (DEBITO)</th>
                            <th>MAESTRO (MASTER DEBITO)</th>
                          </tr>
                        </thead>
                        <tbody>
                          <%do until rs.EOF%>
						  <%if rs("ven_monto") > 0 AND (year(rs("ven_fechapago")) = rep_ano AND month(rs("ven_fechapago")) = rep_mes) then%>
                          <tr>
                            <td><%=rs("ven_fechapago")%></td>
                            <td><%=rs("ven_nombre")%></td>
                            <td align="right"><%if rs("ven_tipopago") = "Efectivo" then
								tot_Efectivo = tot_Efectivo + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "Cuenta corriente" then
								tot_Cuenta_corriente = tot_Cuenta_corriente + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "VISA 1 PAGO" then
								tot_VISA_1_PAGO = tot_VISA_1_PAGO + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "VISA 3 PAGOS" then
								tot_VISA_3_PAGOS = tot_VISA_3_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "VISA 6 PAGOS" then
								tot_VISA_6_PAGOS = tot_VISA_6_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "VISA 12 PAGOS" then
								tot_VISA_12_PAGOS = tot_VISA_12_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "MASTERCARD 1 PAGO" then
								tot_MASTERCARD_1_PAGO = tot_MASTERCARD_1_PAGO + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "MASTERCARD 3 PAGOS" then
								tot_MASTERCARD_3_PAGOS = tot_MASTERCARD_3_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "MASTERCARD 6 PAGOS" then
								tot_MASTERCARD_6_PAGOS = tot_MASTERCARD_6_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "MASTERCARD 12 PAGOS" then
								tot_MASTERCARD_12_PAGOS = tot_MASTERCARD_12_PAGOS + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "VISA ELECTRON (DEBITO)" then
								tot_VISA_ELECTRON = tot_VISA_ELECTRON + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago") = "MAESTRO (MASTER DEBITO)" then
								tot_MAESTRO = tot_MAESTRO + rs("ven_monto")%>
                            	$ <%=rs("ven_monto")%>
                                <%end if%></td>
                          </tr>
                          <%end if%>
                          <%if rs("ven_monto1") > 0 AND (year(rs("ven_fechapago1")) = rep_ano AND month(rs("ven_fechapago1")) = rep_mes) then%>
                          <tr>
                            <td><%=rs("ven_fechapago1")%></td>
                            <td><%=rs("ven_nombre")%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "Efectivo" then
								tot_Efectivo = tot_Efectivo + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "Cuenta corriente" then
								tot_Cuenta_corriente = tot_Cuenta_corriente + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "VISA 1 PAGO" then
								tot_VISA_1_PAGO = tot_VISA_1_PAGO + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "VISA 3 PAGOS" then
								tot_VISA_3_PAGOS = tot_VISA_3_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "VISA 6 PAGOS" then
								tot_VISA_6_PAGOS = tot_VISA_6_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "VISA 12 PAGOS" then
								tot_VISA_12_PAGOS = tot_VISA_12_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "MASTERCARD 1 PAGO" then
								tot_MASTERCARD_1_PAGO = tot_MASTERCARD_1_PAGO + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "MASTERCARD 3 PAGOS" then
								tot_MASTERCARD_3_PAGOS = tot_MASTERCARD_3_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "MASTERCARD 6 PAGOS" then
								tot_MASTERCARD_6_PAGOS = tot_MASTERCARD_6_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "MASTERCARD 12 PAGOS" then
								tot_MASTERCARD_12_PAGOS = tot_MASTERCARD_12_PAGOS + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "VISA ELECTRON (DEBITO)" then
								tot_VISA_ELECTRON = tot_VISA_ELECTRON + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                            <td align="right"><%if rs("ven_tipopago1") = "MAESTRO (MASTER DEBITO)" then
								tot_MAESTRO = tot_MAESTRO + rs("ven_monto1")%>
                            	$ <%=rs("ven_monto1")%>
                                <%end if%></td>
                          </tr>
                          <%end if%>                          
                          <%rs.movenext
					      loop%>
                        </tbody>
                        <tbody>
                          <tr>
                            <td>TOTALES SHOWROOM</td>
                            <td></td>
                            <td align="right">$ <%=tot_Efectivo%></td>
                            <td align="right"  style="background-color:#FFCCCC;">$ <%=tot_Cuenta_corriente%></td>
                            <td align="right">$ <%=tot_VISA_1_PAGO%></td>
                            <td align="right">$ <%=tot_VISA_3_PAGOS%></td>
                            <td align="right">$ <%=tot_VISA_6_PAGOS%></td>
                            <td align="right">$ <%=tot_VISA_12_PAGOS%></td>
                            <td align="right">$ <%=tot_MASTERCARD_1_PAGO%></td>
                            <td align="right">$ <%=tot_MASTERCARD_3_PAGOS%></td>
                            <td align="right">$ <%=tot_MASTERCARD_6_PAGOS%></td>
                            <td align="right">$ <%=tot_MASTERCARD_12_PAGOS%></td>
                            <td align="right">$ <%=tot_VISA_ELECTRON%></td>
                            <td align="right">$ <%=tot_MAESTRO%></td>
                          </tr>
                        </tbody>                        
                      </table>
                      <%end if
					  rs.close%>
                      
                      <br>
<br>
<b>TOTALES FINAL</b><br>


                
<%dim ttt_efectivo, ttt_tarjeta, ttt_mercadopago , ttt_total, ttt_tranferencia
						
						ttt_efectivo = tot_efectivo 
						ttt_tranferencia = tot_Transferencia
						ttt_mercadopago = tot_Mercadopago
						ttt_tarjeta = tot_VISA_1_PAGO +	tot_VISA_3_PAGOS +	tot_VISA_6_PAGOS +	tot_VISA_12_PAGOS +	tot_MASTERCARD_1_PAGO +	tot_MASTERCARD_3_PAGOS +		tot_MASTERCARD_6_PAGOS
						ttt_total = ttt_efectivo + ttt_mercadopago + ttt_tarjeta%>
                        
                      <table class="table table-bordered table-hover">
                        <tbody>
                          <tr>
                            <td>Efectivo</td>
                            <td align="right">$ <%=ttt_efectivo%></td>
                          </tr>
                          <tr>
                            <td>Tarjeta</td>
                            <td align="right">$ <%=ttt_tarjeta%></td>
                          </tr>
                          <tr>
                            <td>Tranferencia</td>
                            <td align="right">$ <%=ttt_tranferencia%></td>
                          </tr>                          
                          <tr>
                            <td>Mercadopado</td>
                            <td align="right">$ <%=ttt_mercadopago%></td>
                          </tr>
                          <tr>
                            <td><b>TOTAL<b></td>
                            <td align="right"><b>$ <%=ttt_total%></b></td>
                          </tr>                                                                              
                        </tbody>                        
                      </table>

</body>
</html>                      
                      
<!--#include file="includes/closeconn.asp" -->


PK 99