mirror of
https://github.com/KeymonSoft/Guna_Reparto_Imp.git
synced 2026-04-20 06:09:19 +00:00
...
This commit is contained in:
@@ -136,6 +136,7 @@ Sub Class_Globals
|
||||
Private PB_carga2 As ProgressBar
|
||||
Private l_carga2 As Label
|
||||
'fin carga
|
||||
Private b_impresion_rec As Button
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -826,6 +827,7 @@ Sub Subir_Click
|
||||
' envioinfo
|
||||
' Else
|
||||
envioinfo
|
||||
imp_LIQUIDACION
|
||||
' End If
|
||||
' c.Close
|
||||
|
||||
@@ -1223,6 +1225,11 @@ Sub cargaGeneral
|
||||
reqManager.ExecuteQuery(cmd , 0, "gunaprod")
|
||||
Log($"Pedimos gunaprod - ${ALMACEN}, ${e_ruta.text}"$)
|
||||
reqs.Add("gunaprod")
|
||||
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_GEOCERCA_GUNA_VN"
|
||||
cmd.Parameters = Array As Object(ALMACEN)
|
||||
reqManager.ExecuteQuery(cmd , 0, "GEOCERCA")
|
||||
|
||||
If ALMACEN = "81" Then
|
||||
|
||||
@@ -1322,6 +1329,17 @@ Sub JobDone(Job As HttpJob)
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "GEOCERCA" Then 'query tag
|
||||
Starter.skmt.ExecNonQuery("DELETE FROM GEOCERCA")
|
||||
For Each records() As Object In result.Rows
|
||||
Dim CAT_AL_GEOCERCA As String = records(result.Columns.Get("CAT_AL_GEOCERCA"))
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO GEOCERCA(ACTIVA) VALUES (?)", Array As Object (CAT_AL_GEOCERCA))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "select_abonosp" Then 'query tag
|
||||
@@ -1994,6 +2012,7 @@ Sub e_ruta_EnterPressed
|
||||
Starter.skmt.ExecNonQuery("delete from HIST_REPARTO_GEO")
|
||||
Starter.skmt.ExecNonQuery("delete from pedido_cliente")
|
||||
Starter.skmt.ExecNonQuery("delete from PAGARES")
|
||||
Starter.skmt.ExecNonQuery("DELETE FROM GEOCERCA")
|
||||
Starter.skmt.ExecNonQuery("delete from CHECADO_CHECK")
|
||||
Starter.skmt.ExecNonQuery("delete from CHECKLIST2")
|
||||
Starter.skmt.ExecNonQuery("delete from pedido")
|
||||
@@ -2304,15 +2323,23 @@ End Sub
|
||||
Private Sub b_rechazos_Click
|
||||
Dim label1 As Label
|
||||
label1 = lv_prod_Prin.SingleLineLayout.Label
|
||||
label1.TextSize = 20
|
||||
label1.TextSize = 18
|
||||
label1.TextColor = Colors.White
|
||||
p_prod.Width = Root.Width
|
||||
p_prod.Height = Root.Height
|
||||
lv_prod_Prin.Width = Root.Width
|
||||
b_regreso.Left = (p_prod.Width - b_regreso.Width) / 2
|
||||
' b_regreso.Left = (p_prod.Width - b_regreso.Width) / 2
|
||||
b_regreso.Top = p_prod.Height - b_regreso.Height
|
||||
|
||||
b_impresion_rec.Top = p_prod.Height - b_impresion_rec.Height
|
||||
' label1.TextSize = 20
|
||||
label1.Typeface = Typeface.CreateNew(Typeface.DEFAULT_BOLD, Typeface.STYLE_BOLD)
|
||||
|
||||
If l_ctast.Text = "0" Then
|
||||
b_impresion_rec.Enabled = True
|
||||
Else If l_ctast.Text <> "0" Then
|
||||
b_impresion_rec.Enabled = False
|
||||
End If
|
||||
|
||||
' lv_prod_Prin.Left = p_prod.Width / 2
|
||||
lv_prod_Prin.Width = Root.Width - (Root.Width * .10)
|
||||
@@ -2320,7 +2347,7 @@ Private Sub b_rechazos_Click
|
||||
Subs.centraListView(lv_prod_Prin,Root.Width)
|
||||
p_prod.Visible = True
|
||||
p_prod.BringToFront
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("select HVD_PRONOMBRE, IFNULL(SUM(HVD_RECHAZOCANT), 0) AS HVD_RECHAZOCANT, HVD_PROID from HIST_VENTAS WHERE hvd_rechazo <> 2 and HVD_RECHAZOCANT > 0 GROUP BY HVD_PROID order by HVD_PRONOMBRE asc")
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("select HVD_PRONOMBRE, IFNULL(SUM(HVD_RECHAZOCANT), 0) AS HVD_RECHAZOCANT, HVD_PROID from HIST_VENTAS WHERE hvd_rechazo <> 2 and HVD_RECHAZOCANT > 0 and HVD_PRONOMBRE <> 'Cobranza Pendiente' GROUP BY HVD_PROID order by HVD_PRONOMBRE asc")
|
||||
lv_prod_Prin.SingleLineLayout.Label.TextColor = Colors.White
|
||||
lv_prod_Prin.Clear
|
||||
If c.RowCount > 0 Then
|
||||
@@ -2339,8 +2366,10 @@ Private Sub b_rechazos_Click
|
||||
If ( c.GetInt("HVD_RECHAZOCANT") - resta) <= 0 Then
|
||||
|
||||
Else
|
||||
' If c.GetString("HVD_PRONOMBRE") <> "Cobranbra Pendiente" Then
|
||||
itemText = $"${c.GetString("HVD_PRONOMBRE")} ${CRLF}Inventario: ${(c.GetInt("HVD_RECHAZOCANT") - resta)}"$
|
||||
lv_prod_Prin.AddSingleLine(itemText)
|
||||
' End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
@@ -2883,4 +2912,275 @@ Private Sub ImageView1_LongClick
|
||||
d.Position=0
|
||||
cuantos_noventa = D.GetString("CUANTOS_NOVENTA")
|
||||
d.Close
|
||||
End Sub
|
||||
|
||||
Private Sub b_impresion_rec_Click
|
||||
Dim totalentrega As Int
|
||||
Dim totalrechazo As Int
|
||||
Dim totalpiezas As Int
|
||||
Dim sDate, sTime As String
|
||||
c=Starter.skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
' DateTime.DateFormat = "MM/dd/yyyy"
|
||||
DateTime.DateFormat = "dd/MM/yyyy"
|
||||
DateTime.TimeFormat="HH:mm:ss"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c.Close
|
||||
' c=Starter.skmt.ExecQuery2("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION =?", Array As String ("SUCURSAL"))
|
||||
' c.Position = 0
|
||||
' sucursal = c.GetString("CAT_VA_VALOR")
|
||||
' c.Close
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
' Log("Conectando a impresora ...")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
' Log("++++++ " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
' Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
' Log("****** " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
|
||||
TAMANO = 0
|
||||
ESPACIO = 28
|
||||
BLANCO = " "
|
||||
|
||||
Printer1.WriteString("gUNA Distribuciones" & CRLF)
|
||||
Printer1.WriteString(sDate & " " &sTime & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("------------RECHAZO-----------" & CRLF)
|
||||
|
||||
Private c As Cursor = Starter.skmt.ExecQuery("select HVD_PRONOMBRE, IFNULL(SUM(HVD_RECHAZOCANT), 0) AS HVD_RECHAZOCANT, IFNULL(SUM(HVD_CANT), 0) AS HVD_CANT, (IFNULL(SUM(HVD_CANT), 0) - IFNULL(SUM(HVD_RECHAZOCANT), 0)) as total, HVD_PROID from HIST_VENTAS where HVD_RECHAZO = 1 AND HVD_PRONOMBRE <> 'Cobranza Pendiente' GROUP BY HVD_PROID order by HVD_PRONOMBRE asc")
|
||||
If c.RowCount > 0 Then
|
||||
For i = 0 To c.RowCount - 1
|
||||
c.Position = i
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
|
||||
Private c3 As Cursor=Starter.skmt.ExecQuery($"select Ifnull(sum(PE_CANT),0) AS PE_CANT from PEDIDO WHERE PE_PROID ='${c.GetString("HVD_PROID")}'"$)
|
||||
Private resta As String = 0
|
||||
|
||||
If c3.RowCount > 0 Then
|
||||
c3.Position = 0
|
||||
resta = c3.GetString("PE_CANT")
|
||||
Else
|
||||
resta = 0
|
||||
End If
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString(c.GetString("HVD_PRONOMBRE") & CRLF)
|
||||
' Printer1.Justify = 0
|
||||
' Printer1.WriteString("TP: "& c.GetInt("HVD_CANT")&" ")
|
||||
' Printer1.Justify = 1
|
||||
' Printer1.WriteString(" TE: " & (c.GetInt("total") + resta)&" ")
|
||||
' Printer1.Justify = 2
|
||||
Printer1.WriteString("RECHAZO: " & (c.GetInt("HVD_RECHAZOCANT") - resta)&" ")
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
' Printer1.WriteString(" " & CRLF)
|
||||
|
||||
' itemText2 = $"${c.GetString("HVD_PRONOMBRE")} ${CRLF} TP: ${(c.GetInt("HVD_CANT"))} TE: ${( c.GetInt("total") + resta)} TR: ${(c.GetInt("HVD_RECHAZOCANT") - resta)}"$
|
||||
totalentrega = totalentrega + c.GetInt("total") + resta
|
||||
totalrechazo = totalrechazo + c.GetInt("HVD_RECHAZOCANT") - resta
|
||||
totalpiezas = totalpiezas + c.GetInt("HVD_CANT")
|
||||
' Log(itemText2)
|
||||
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
' Printer1.WriteString("Total Piezas: "& totalpiezas & CRLF)
|
||||
' Printer1.WriteString("Total Entrega: "& totalentrega & CRLF)
|
||||
Printer1.WriteString("Total Rechazo: "& totalrechazo & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
|
||||
ProgressDialogHide
|
||||
End Sub
|
||||
|
||||
Sub imp_LIQUIDACION
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
' If logger Then Log("conectando 1")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
cont = cont + 1
|
||||
If cont = 7 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 15 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
' If logger Then Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 4 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
|
||||
TAMANO = 0
|
||||
ESPACIO = 29
|
||||
BLANCO = " "
|
||||
Printer1.Justify = 0
|
||||
Dim sDate, sTime As String
|
||||
DateTime.DateFormat = "dd/MM/yyyy"
|
||||
DateTime.TimeFormat = "HH:mm:ss"
|
||||
sDate = DateTime.Date(DateTime.Now)
|
||||
sTime = DateTime.Time(DateTime.Now)
|
||||
Printer1.WriteString("Fecha: " &sDate & CRLF)
|
||||
Printer1.WriteString("Hora: " &sTime & CRLF)
|
||||
Printer1.WriteString("Ruta: " & l_ruta.Text & CRLF)
|
||||
Printer1.WriteString("Usuario: " & Subs.dameUsuarioDeDB & CRLF)
|
||||
Printer1.WriteString("----------LIQUIDACION----------" & CRLF)
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
|
||||
Printer1.WriteString("Monto entregado: $" & NumberFormat2(L_MONTOE.Text,0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Monto rechazado: $" & NumberFormat2(l_rechazo.Text,0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Pagares cobrados: $" & NumberFormat2(l_pagarescobrados.Text,0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
If l_pagarescobrados.Text > 0 Then
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString(" Cliente Abono" & CRLF)
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
' Printer1.WriteString( CRLF)
|
||||
Dim abonoscreditos As Cursor = Starter.skmt.ExecQuery("SELECT a_abono, length(a_abono) as L_abono , length(a_cliente) as L_cliente , a_cliente FROM ABONOS ORDER BY a_cliente")
|
||||
For g = 0 To abonoscreditos.RowCount -1
|
||||
abonoscreditos.Position = g
|
||||
|
||||
TAMANO = abonoscreditos.GetInt("L_abono") + TAMANO
|
||||
ESPACIO = (ESPACIO - TAMANO)/2
|
||||
' Log(ESPACIO)
|
||||
For j =0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( abonoscreditos.GetString("a_cliente") & BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString( NumberFormat2(abonoscreditos.GetString("a_abono"),0,2,2,True))
|
||||
Printer1.WriteString( CRLF)
|
||||
TAMANO = 0
|
||||
ESPACIO = 29
|
||||
BLANCO = " "
|
||||
Printer1.Justify = 0
|
||||
Next
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString( CRLF)
|
||||
End If
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Pagares nuevos: $" & NumberFormat2(l_pagaresnuevos.Text,0,2,2,True) & CRLF)
|
||||
|
||||
If l_pagaresnuevos.Text > 0 Then
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString(" Cliente Pagare" & CRLF)
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
' Printer1.WriteString( CRLF)
|
||||
Dim abonoscreditos As Cursor = Starter.skmt.ExecQuery("SELECT PA_MONTO, length(PA_MONTO) as L_PA_MONTO , length(PA_CLIENTE) as L_cliente , PA_CLIENTE FROM PAGARES ORDER BY PA_CLIENTE")
|
||||
For g = 0 To abonoscreditos.RowCount -1
|
||||
abonoscreditos.Position = g
|
||||
|
||||
TAMANO = abonoscreditos.GetInt("L_PA_MONTO") + TAMANO
|
||||
ESPACIO = (ESPACIO - TAMANO)/2
|
||||
' Log(ESPACIO)
|
||||
For j =0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( abonoscreditos.GetString("PA_CLIENTE") & BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString( NumberFormat2(abonoscreditos.GetString("PA_MONTO"),0,2,2,True))
|
||||
Printer1.WriteString( CRLF)
|
||||
TAMANO = 0
|
||||
ESPACIO = 29
|
||||
BLANCO = " "
|
||||
Printer1.Justify = 0
|
||||
Next
|
||||
Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString( CRLF)
|
||||
End If
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Dim abonoscreditosefe As Cursor = Starter.skmt.ExecQuery("SELECT SUM(IFNULL(a_abono,0)) AS ABONO FROM ABONOS WHERE TIPO_PAGO = 'EFECTIVO' ORDER BY a_cliente")
|
||||
abonoscreditosefe.Position = 0
|
||||
Dim abonoscreditostrans As Cursor = Starter.skmt.ExecQuery("SELECT SUM(IFNULL(a_abono,0)) AS ABONO FROM ABONOS WHERE TIPO_PAGO = 'TRANSFERENCIA' ORDER BY a_cliente")
|
||||
abonoscreditostrans.Position = 0
|
||||
Dim abonoscreditosche As Cursor = Starter.skmt.ExecQuery("SELECT SUM(IFNULL(a_abono,0)) AS ABONO FROM ABONOS WHERE TIPO_PAGO = 'CHEQUE' ORDER BY a_cliente")
|
||||
abonoscreditosche.Position = 0
|
||||
Log(NumberFormat2(abonoscreditosefe.GetDouble("ABONO"),0,2,2,False) )
|
||||
|
||||
Printer1.WriteString("Monto efectivo: $" & NumberFormat2((l_montoaliquidar.Text - abonoscreditosche.GetDouble("ABONO") - abonoscreditostrans.GetDouble("ABONO")),0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Monto cheque: $" & NumberFormat2(abonoscreditosche.GetDouble("ABONO"),0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Monto transferencia: $" & NumberFormat2(abonoscreditostrans.GetDouble("ABONO"),0,2,2,True) & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("Monto a liquidar: $" & NumberFormat2(l_montoaliquidar.Text,0,2,2,True) & CRLF)
|
||||
|
||||
|
||||
|
||||
' Dim sumainv As Cursor = Starter.skmt.ExecQuery("SELECT SUM(HVD_CANT) AS CANTIDAD FROM HIST_VENTAS WHERE HVD_CODPROMO <> HVD_PROID")
|
||||
' sumainv.Position = 0
|
||||
'
|
||||
' Printer1.WriteString("------------------------------" & CRLF)
|
||||
' Printer1.WriteString("Total piezas: " & sumainv.GetString("CANTIDAD")& CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
ProgressDialogHide
|
||||
|
||||
|
||||
Msgbox2Async("Deseas imprimir de nuevo el ticket?", "ATENCION","SI","", "NO",LoadBitmap(File.DirAssets,"alert2.png"), False)
|
||||
Wait For Msgbox_Result (resultado As Int)
|
||||
If resultado = DialogResponse.POSITIVE Then
|
||||
imp_LIQUIDACION
|
||||
Else
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub connecta_LongClick
|
||||
imp_LIQUIDACION
|
||||
End Sub
|
||||
Reference in New Issue
Block a user