diff --git a/B4A/B4XMainPage.bas b/B4A/B4XMainPage.bas index d52b8aa..33f4f9e 100644 --- a/B4A/B4XMainPage.bas +++ b/B4A/B4XMainPage.bas @@ -62,7 +62,7 @@ Sub Class_Globals Private IMEN As EditText Private Entrar As Button Private Panel1 As Panel - Private ImageView4 As ImageView + Private i_engranes As ImageView Private E_SERVER As EditText Private B_SERVER As Button Private B_MACIMP As Button @@ -600,7 +600,7 @@ Sub user_EnterPressed If existe = 1 Then Subs.iniciaActividad("Principal") End Sub -Sub ImageView4_Click +Sub i_engranes_Click Entrar.Visible = False ' Starter.server = "http://201.99.139.28:1782" ' Starter.server = "http://177.244.63.54:1782" @@ -624,7 +624,7 @@ Sub ImageView4_Click If user.Text = "KMTS1" Then b_importarBD.Visible = True Else b_importarBD.Visible = False End Sub -Private Sub ImageView4_LongClick +Private Sub i_engranes_LongClick ' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE) ' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) ' Subs.copiaDB(Result) diff --git a/B4A/C_CheckList.bas b/B4A/C_CheckList.bas index dff232b..9e1e1b5 100644 --- a/B4A/C_CheckList.bas +++ b/B4A/C_CheckList.bas @@ -80,7 +80,7 @@ Sub Class_Globals Private Ch_NVL_REFRIGE As CheckBox Private Ch_NVL_LIQUIDBRI As CheckBox Private Ch_COND_BANMOTOR As CheckBox - ''''' PANEL5 + ''''' p_resumenAcumulado Private Ch_FUGASGRAL As CheckBox Private Ch_FRENOS As CheckBox Private Edt_COMENTARIO As AutoCompleteEditText diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index c1abc6f..63bed03 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -275,7 +275,7 @@ Sub Class_Globals Private BP_DOE_R1 As Button Private ime As IME Dim laDist As Float - Private Panel11 As Panel + Private p_rechazoDOE As Panel Dim RMI_VALOR As String Dim errorImpresora As Int = 0 Private b_inicioFinVenta As Button @@ -400,20 +400,15 @@ End Sub Sub B4XPage_Appear clienteId = kh.traeCliente P_DOE.Visible = False - If clienteId.StartsWith("N") Then b_noVenta.Visible = False + dentroDeGeocerca = False + ' Log($"TOTAL VENTA: ${kh.traeTotalCliente}"$) B_VENTA.Visible = False b_noVenta.Visible = False + If clienteId.StartsWith("N") Then b_noVenta.Visible = False + l_doe.Text = "HAY PEDIDO DOE" ' Log(Starter.rp.Check("android.permission.BLUETOOTH_CONNECT")) - b_inicioFinVenta.Text = "INICIAR VENTA" - b_inicioFinVenta.BringToFront - If Not(Starter.enVenta) And la_cuenta.Text <> "0" Then - b_inicioFinVenta.Visible = True -' Log("EnVenta Visible") - Else -' Log("EnVenta NO Visible") - b_inicioFinVenta.Visible = False - End If + reqManager.Initialize(Me, Starter.DBReqServer) usarGeocerca = kh.traeUsarGeocerca ' Log(Subs.traeUltimaActividadBD) @@ -477,6 +472,18 @@ Sub B4XPage_Appear If c.GetString("CAT_CL_ATIENDE1") <> Null And c.GetString("CAT_CL_ATIENDE1") <> "null" Then l_atiende.Text = c.GetString("CAT_CL_ATIENDE1") l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2") + b_inicioFinVenta.Text = "INICIAR VENTA" + b_inicioFinVenta.BringToFront +' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red) + If Not(Starter.enVenta) And la_cuenta.Text <> "0" Then + b_inicioFinVenta.Visible = True +' Log("EnVenta Visible") + Else +' Log("EnVenta NO Visible") + b_inicioFinVenta.Visible = False + End If +' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red) + ' LONGITUD = 0 ' If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG") ' LATITUD = 0 @@ -508,22 +515,22 @@ Sub B4XPage_Appear ' LogColor($"${c.GetString("CAT_CL_LAT")}, ${c.GetString("CAT_CL_LONG")}"$, Colors.red) If logger Then Log($"Lat: ${LATITUD}, Lon: ${LONGITUD}"$) NOMBRE = c.GetString("CAT_CL_NOMBRE") -' Log(l_total.text) - If l_total.Text = Null Or l_total.Text = "null" Then - If Not(clienteId.StartsWith("N")) Then b_noVenta.Visible = True + Log($"TOTAL DE LA VENTA: ${kh.traeTotalCliente}"$) + If kh.traeTotalCliente < 0.01 And kh.traeTotalClienteDOE < 0.01 Then + If Not(clienteId.StartsWith("N")) And la_cuenta.Text <> "0" Then b_noVenta.Visible = True 'Ni cliente nuevo, ni abordo. Else b_noVenta.Visible = False - If la_cuenta.Text = "0" Then + If la_cuenta.text = 0 Then CREDITO_DISPONIBLE = 10000000 CREDITO = 0 b_inicioFinVenta.Visible = False End If End If - If S1.GetString("CUANTOS") = 0 Then -' b_noVenta.Visible = True - Else 'Si ya hay venta, ocultamos el boton de "NO VENTA" - b_noVenta.Visible = False - End If +' If S1.GetString("CUANTOS") = 0 Then +'' b_noVenta.Visible = True +' Else 'Si ya hay venta, ocultamos el boton de "NO VENTA" +' b_noVenta.Visible = False +' End If If CREDITO = "1" Then Msgbox("ALTO","A este cliente no se le puede vender ya que tienen adeudo en su crédito") 'ignore B_VENTA.Visible = False @@ -599,7 +606,7 @@ Sub B4XPage_Appear Else Guardar.Visible = True End If - If Not(l_total.Text > 0) Then Guardar.Visible = True + If Not(l_total.Text > 0) And Not(kh.traeTotalClienteDOE > 0) Then Guardar.Visible = True ' If la_cuenta.text = "0" Then Guardar.Visible = True 'Abordo If l_total.Text = Null Or l_total.Text = "null" Or l_total.text = "0" Then Guardar.Visible = True 'Si no hay venta entonces "Guardar" es visible. @@ -702,6 +709,12 @@ Sub B4XPage_Appear Else B_IMP2.Enabled = False End If + If kh.traeTotalClienteDOE > 0 Then + Private cs As CSBuilder + cs.Initialize + l_doe.Text = cs.append($"Pedido DOE: $${kh.traeTotalClienteDOE}"$).color(Colors.red).append(CRLF).Append($"TOTAL PEDIDO: $${(kh.traeTotalCliente+kh.traeTotalClienteDOE)}"$).Popall + ' l_doe.Text = $"Pedido DOE: $${kh.traeTotalClienteDOE}${CRLF}TOTAL PEDIDO: $${(kh.traeTotalCliente+kh.traeTotalClienteDOE)}"$ + End If If Subs.revisaImpresa Then Guardar.Visible = True End Sub @@ -733,7 +746,7 @@ End Sub Sub GPS_LocationChanged (Location1 As Location) 'Este codigo se corre desde Tracker/flp_LocationChanged b_ubicacion.TextColor = Colors.Gray - Sleep(200) +' Sleep(200) b_ubicacion.TextColor = Colors.White If logger Then Log($"${Location1.Latitude}, ${Location1.Longitude}, ${Location1.Accuracy}"$) @@ -760,6 +773,7 @@ Sub GPS_LocationChanged (Location1 As Location) Else l_ubicacion2.TextColor = Colors.Black dentroDeGeocerca = True + Log("dentro de geocerca") End If '''' GEO CERCA @@ -795,9 +809,9 @@ Sub GPS_LocationChanged (Location1 As Location) ' Log($"${gps_boton_doe}|${clienteConPromo}"$) - If gps_boton_doe = "1" And clienteConPromo = "0" Then b_whats.Visible = True + If gps_boton_doe = "1" And clienteConPromo = "0" And revisaExistenciasDOE Then b_whats.Visible = True If Not(clienteDeudor) Then B_VENTA.Visible = True 'Si el cliente no tiene adeudo, habilitamos el boton de venta - pedido_doe_muestra + If Not(p_rechazoDOE.Visible) Then pedido_doe_muestra Else b_noVenta.Visible = False B_VENTA.Visible = False @@ -838,6 +852,10 @@ Private Sub B4XPage_CloseRequest As ResumableSub else if p_promowhats.Visible Then P_INF_GENERAL.Visible = True p_promowhats.Visible = False + else if p_rechazoDOE.Visible Then + p_rechazoDOE.Visible = False + BP_DOE_A.Visible = True + BP_DOE_R.Visible = True Else Msgbox("Presione Imprimir y Guardar para continuar","Aviso") 'ignore End If @@ -906,7 +924,6 @@ Sub Guardar_Click If logger Then Log("Cerramos Cliente, iniciamos Principal") ' B4XPages.ShowPage("Principal") - B4XPages.MainPage.productos.reiniciarlistaProds = True B4XPages.MainPage.productos.prodsMap.Initialize B4XPages.MainPage.promos.promosMap.Initialize @@ -921,6 +938,7 @@ Sub Guardar_Click Else b_inicioFinVenta.Visible = False Starter.enVenta = False +' LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red) Subs.iniciaActividad("principal") B4XPages.ShowPageAndRemovePreviousPages("Principal") End If @@ -3773,7 +3791,7 @@ Private Sub b_aceptarrpomo_Click ' l_promowhats.Text = c.GetString("CAT_CL_NOMBRE") ' End If ' c.Close - Private almadoe As Cursor = Starter.skmt.ExecQuery("SELECT ID_ALMACEN FROM CAT_ALMaCEN") + Private almadoe As Cursor = Starter.skmt.ExecQuery("SELECT ID_ALMACEN FROM CAT_ALMACEN") almadoe.Position = 0 LogColor(almadoe.GetString("ID_ALMACEN"),Colors.Blue) If almadoe.GetString("ID_ALMACEN") = "3" Then @@ -3809,7 +3827,7 @@ Private Sub b_aceptarrpomo_Click Starter.skmt.ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)", Array As Object(clie_id, sDate & sTime, usuario, c.GetString("CANT_CLIE"),c.GetString("TOTAL_CLIE"), Starter.lon_gps, Starter.lat_gps,Id_Almacen,Starter.rutaV,c.GetString("TOTAL_CLIE_SIN"))) Starter.skmt.ExecNonQuery("delete from pedido3") Starter.skmt.ExecNonQuery("UPDATE PEDIDO SET PE_FOLIO = 0 where PE_FOLIO IS NULL") - Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO3 (PE_PRECIO2, PE_TIPO, PE_FECHA, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO ) SELECT PE_PRECIO2, PE_TIPO, PE_FECHA, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, SUM(PE_COSTO_TOT) AS PE_COSTO_TOT, PE_COSTOU, SUM(PE_CANT) As PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) GROUP BY PE_PRECIO2, PE_TIPO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTOU, PE_PRONOMBRE, PE_PROID, PE_CLIENTE ") 'Mod por CHV - 220302 - Agregué PE_FECHA al select/insert + Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO3 (PE_PRECIO2, PE_TIPO, PE_FECHA, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO ) SELECT PE_PRECIO2, PE_TIPO, PE_FECHA, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, SUM(PE_COSTO_TOT) AS PE_COSTO_TOT, PE_COSTOU, SUM(PE_CANT) As PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) GROUP BY PE_PRECIO2, PE_TIPO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTOU, PE_PRONOMBRE, PE_PROID, PE_CLIENTE ") ' starter.skmt.ExecNonQuery2("INSERT INTO") p_promowhats.Visible = False P_INF_GENERAL.Visible = True @@ -3888,7 +3906,7 @@ Private Sub b_geopass_Click Log($"${Starter.DBReqServer}, ${et_geopass.Text}, ${Subs.traeAlmacen}, ${Subs.traeRuta}"$) et_geopass.Text = "" End If - If Not(clienteId.StartsWith("N")) Then b_noVenta.Visible = True + If Not(clienteId.StartsWith("N")) And la_cuenta.Text <> "0" Then b_noVenta.Visible = True 'Ni cliente nuevo, ni abordo. p_pideGeoPass.Visible = False ime.HideKeyboard ' Log("Guardamos coords") @@ -3972,17 +3990,21 @@ Private Sub BP_DOE_A_Click Starter.skmt.TransactionSuccessful Starter.skmt.EndTransaction P_DOE.Visible = False + B4XPage_Appear End Sub Private Sub BP_DOE_R_Click Dim result As Int result = Msgbox2("El cliente perderá el descuento si cancela el pedio, se cancela el pedido ?", "Pedido Cancela", "SI", "", "NO", LoadBitmap(File.DirAssets, "alert2.png")) If result = DialogResponse.Positive Then - Panel11.Visible = True + P_DOE.Visible = False + p_rechazoDOE.BringToFront + p_rechazoDOE.Visible = True BP_DOE_A.Visible = False BP_DOE_R.Visible = False Else - P_DOE.Visible = False + P_DOE.Visible = True +' Log("yyy") End If End Sub @@ -4000,8 +4022,9 @@ private Sub pedido_doe_muestra If YA_TIENE_PEDIDO_DOE = 0 Then C5=Starter.skmt.ExecQuery("select COUNT(*) AS CLIENTE_DOE from PEDIDO_DOE WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) ") C5.Position = 0 - If C5.GetString("CLIENTE_DOE") >0 Then - P_DOE.VISIBLE = True + If C5.GetString("CLIENTE_DOE") > 0 Then +' Log("xxx") + P_DOE.Visible = True P_DOE.Elevation = 100 P_DOE.BringToFront C6=Starter.skmt.ExecQuery("select PE_PROID, PE_PRONOMBRE, PE_CANT, PE_COSTO_TOT from PEDIDO_DOE where PE_CLIENTE IN (Select CUENTA from cuentaa)") @@ -4046,7 +4069,7 @@ Private Sub BP_DOE_R1_Click motivo = motivo & " " & e_comm.Text BP_DOE_A.Visible = True BP_DOE_R.Visible = True - Panel11.Visible = False + p_rechazoDOE.Visible = False P_DOE.Visible = False c=Starter.skmt.ExecQuery("select PE_PROID,PE_CANT, PE_TIPO FROM PEDIDO_DOE where pe_cliente in (Select CUENTA from cuentaa) ") If c.RowCount>0 Then @@ -4059,6 +4082,7 @@ Private Sub BP_DOE_R1_Click Starter.skmt.ExecNonQuery("delete from PEDIDOS_DOE_ENTREGA where PC_CLIENTE in (Select CUENTA from cuentaa)") Starter.skmt.ExecNonQuery2("insert into PEDIDOS_DOE_ENTREGA (PC_CLIENTE, PC_ENTREGA) VALUES (?,?) ", Array As Object(clie_id,motivo)) Starter.skmt.ExecNonQuery("delete from pedido_DOE where pe_cliente in (Select CUENTA from cuentaa)") + Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario, Id_Almacen, ruta_tienda, "Rechazo DOE", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, "2", "", "") P_DOE.Visible = False End Sub @@ -4067,15 +4091,39 @@ Private Sub b_inicioFinVenta_Click If Starter.enVenta Then Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, Id_Almacen, ruta_tienda, "Termina Venta", la_cuenta.text, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, precision, motivoNoVenta, "") Starter.enVenta = False + LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red) Subs.iniciaActividad("principal") B4XPages.ShowPageAndRemovePreviousPages("Principal") Else Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario, Id_Almacen, ruta_tienda, "Inicia Venta", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, precision, motivoNoVenta, "") Starter.enVenta = True + LogColor(">>>>>> EN VENTA: " & Starter.enVenta, Colors.red) End If b_inicioFinVenta.Visible = False End Sub Private Sub P_DOE_Click +End Sub + +Private Sub p_rechazoDOE_Click + +End Sub + +'Revisa si hay suficiente existencia para dar la promo DOE. +Sub revisaExistenciasDOE As Boolean 'ignore + Private suficiente As Boolean = True + Private p As Cursor = Starter.skmt.ExecQuery($"select * from cat_gunaprod2 where cat_gp_id in ('1008027226', '1008027228', '1008013799')"$) + If p.RowCount > 1 Then + For i = 0 To p.RowCount - 1 + p.Position = i + If p.GetString("CAT_GP_ID") = "1008027226" And p.GetString("CAT_GP_ALMACEN") < 2 Then suficiente = False + If p.GetString("CAT_GP_ID") = "1008027228" And p.GetString("CAT_GP_ALMACEN") < 1 Then suficiente = False + If p.GetString("CAT_GP_ID") = "1008013799" And p.GetString("CAT_GP_ALMACEN") < 1 Then suficiente = False + Next + End If +' 2, "LECHE ALL BRAN CHOCO 236ML", "1008027226" +' 1, "LECHE ALL BRAN NUEZ 236ML", "1008027228" +' 1, "LECHE CHOCO MELVIN 236ML", "1008013799" + Return suficiente End Sub \ No newline at end of file diff --git a/B4A/C_Clientes.bas b/B4A/C_Clientes.bas index 2a940e6..3b55e8f 100644 --- a/B4A/C_Clientes.bas +++ b/B4A/C_Clientes.bas @@ -147,7 +147,7 @@ Sub Activity_KeyPress (key As Int) As Boolean 'ignore End Sub Sub BUSCA_TextChanged (Old As String, New As String) - Log($"${Old}|${New}"$) +' Log($"${Old}|${New}"$) q_buscar = "%" & busca.Text & "%" c2 = Starter.skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where (CAT_CL_NOMBRE like ? OR CAT_CL_CODIGO LIKE ?) and CAT_CL_DIAS_VISITA = (SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?) and gestion = 0 order by CAT_CL_NOMBRE ", Array As String(q_buscar,q_buscar,"DIA_VISITA")) ListView1.Clear diff --git a/B4A/C_Nota.bas b/B4A/C_Nota.bas index 669fd68..893d06e 100644 --- a/B4A/C_Nota.bas +++ b/B4A/C_Nota.bas @@ -256,7 +256,7 @@ Sub borra_Click Private textoExtra As String = "" If pedidoMostrado = "DOE" Then textoExtra = " DOE" If kh.clienteConDOE And pedidoMostrado = "NORMAL" Then textoExtra = " (Sin DOE)" - If folio = "0" Then 'Si el folio es 0 o el cliente actual es "abordo", los deja borrar. - Mod por CHV 220512 'Para que el abordo borre siempre agregar -> " Or Subs.clienteActual = "0"" + If folio = "0" or 1 = 1 Then 'Si el folio es 0 o el cliente actual es "abordo", los deja borrar. - Mod por CHV 220512 'Para que el abordo borre siempre agregar -> " Or Subs.clienteActual = "0"" result = Msgbox2($"¿Seguro que desea borrar el pedido${textoExtra}?"$,"Cancelar pedido", "Si", "", "No", LoadBitmap(File.DirAssets,"alert2.png")) 'ignore If result = DialogResponse.POSITIVE Then ' c = Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_TIPO, PE_CEDIS FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ") @@ -446,7 +446,7 @@ Private Sub clv_pedidos_ItemLongClick (position As Int, Value As Object) c.Close c = Starter.skmt.ExecQuery2("select PE_PRONOMBRE, PE_COSTO_TOT, PE_CANT, PE_FOLIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) AND PE_PRONOMBRE = ? order by PE_PRONOMBRE asc", Array As String(Value) ) c.Position = 0 - If c.GetString("PE_FOLIO") = "0" Then 'Para que el abordo borre siempre agregar -> " Or Subs.clienteActual = "0" " + If c.GetString("PE_FOLIO") = "0" or 1 = 1 Then 'Para que el abordo borre siempre agregar -> " Or Subs.clienteActual = "0" " result = Msgbox2("Seguro que desea borrar este articulo?","Borrar Articulo", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore If result = DialogResponse.POSITIVE Then Private prod As Cursor = Starter.skmt.ExecQuery2("select PE_PROID, PE_CANT, PE_CEDIS FROM PEDIDO where pe_pronombre = ? and pe_cliente in (Select CUENTA from cuentaa) ", Array As String(Value)) @@ -513,7 +513,7 @@ Private Sub lv_prodsDOE_ItemLongClick (Position As Int, Value As Object) If kh.revisaImpresa Then ToastMessageShow("Esta venta ya esta impresa, no se puede editar ni borrar.", False) Else - If folio = "0" Then 'Si el folio es 0 o el cliente actual es "abordo", los deja borrar. - Mod por CHV 220512 poner esto para borrar abordo "Or Subs.clienteActual = "0"" + If folio = "0" or 1 = 1 Then 'Si el folio es 0 o el cliente actual es "abordo", los deja borrar. - Mod por CHV 220512 poner esto para borrar abordo "Or Subs.clienteActual = "0"" result = Msgbox2("Seguro que desea borrar el pedido?","Cancelar pedido", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore If result = DialogResponse.POSITIVE Then c=Starter.skmt.ExecQuery2("select PE_PROID,PE_CANT, PE_TIPO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS = ?", Array As String("DOE")) @@ -521,7 +521,7 @@ Private Sub lv_prodsDOE_ItemLongClick (Position As Int, Value As Object) For i = 0 To c.RowCount - 1 c.Position = i TIPO = c.GetString("PE_TIPO") - If c.GetString("PE_TIPO") = "VENTA" or c.GetString("PE_TIPO") = "DOE" Then + If c.GetString("PE_TIPO") = "VENTA" Or c.GetString("PE_TIPO") = "DOE" Then Log($"update cat_gunaprod2 set cat_gp_almacen = cat_gp_almacen + ${c.GetString("PE_CANT")} where cat_gp_id = 4{c.GetString("PE_PROID")}"$) Starter.skmt.ExecNonQuery2("update cat_gunaprod2 set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID"))) Else diff --git a/B4A/C_Principal.bas b/B4A/C_Principal.bas index 7fff487..d2c9e38 100644 --- a/B4A/C_Principal.bas +++ b/B4A/C_Principal.bas @@ -130,7 +130,7 @@ Sub Class_Globals Private l_monto_c3 As Label Private B_BOLETA As Button Private B_MAPA_RUTA As Button - Private Panel5 As Panel + Private p_resumenAcumulado As Panel Private L_CUOTA1 As Label Private L_CUOTA2 As Label Private L_CUOTA3 As Label @@ -278,7 +278,7 @@ Private Sub B4XPage_Created (Root1 As B4XView) ' kh.centraPanel(PNL_ACCESO, Root.Width) P_RESUMEN.Top = 0 : P_RESUMEN.Left = 0 'Panel Resumen - Panel5.Top = 0 : Panel5.Left = 0 ' Panel Resumen Acumualado +' p_resumenAcumulado.Top = 0 : p_resumenAcumulado.Left = 0 ' Panel Resumen Acumualado p_downloadPDF.Top = 0 : p_downloadPDF.left = 0 P1.Width = GetDeviceLayoutValues.Width P1.Height = GetDeviceLayoutValues.Height @@ -2389,7 +2389,7 @@ Sub Resumen_Click L_MONTOD.Text = c.GetString("MONTO_DIA") L_MONTOD.Text = Subs.sumaPedido(Subs.traeCliente) 'Trae el monto sin el redondeo que a veces hace el SUM(). ' Log(Subs.sumaPedido(Subs.traeCliente) & " - " & L_MONTOD.Text) - Subs.sumaPedido(Subs.traeCliente) +' Subs.sumaPedido(Subs.traeCliente) l_cuantosc.Text = c.GetString("CLIENTES_DIA") l_cuantosn.Text = b.GetString("CUANTOS") L_CUANTOST.Text = NumberFormat2((l_cuantosc.Text + l_cuantosn.Text), 1, 0, 0, False) @@ -2398,8 +2398,7 @@ Sub Resumen_Click l_efectiva.text = Round2(efectiva*100,2) l_ctast.Text = d.GetString("TOTAL_VISITAR") 'l_porvisitar.Text = e.GetString("POR_VISITAR") - drop = (c.GetString("CLIENTES_DIA") + b.GetString("CUANTOS"))/ d.GetString("TOTAL_VISITAR") - l_drop.Text = Round(drop * 100) + l_drop.Text = Round((L_CUANTOST.Text / l_porvisitar.text) * 100) If l_drop.Text + l_efectiva.Text < 100 Then ImageView3.Bitmap = LoadBitmap(File.DirAssets, "tache_rojo.png") Else If l_drop.Text + l_efectiva.Text > = 100 And l_drop.Text + l_efectiva.Text < 130 Then @@ -2543,14 +2542,14 @@ Sub b_cuotas_Click L_META6.Text = 0 End If DDD.Close - Panel5.BringToFront - Panel5.Visible = True + p_resumenAcumulado.BringToFront + p_resumenAcumulado.Visible = True Panel2.Visible = False Panel1.Visible = False End Sub Sub B_CUOATA_C_Click - Panel5.Visible = False + p_resumenAcumulado.Visible = False Panel2.Visible = True Panel1.Visible = True End Sub @@ -3265,4 +3264,8 @@ End Sub Private Sub P_RESUMEN_Click +End Sub + +Private Sub p_resumenAcumulado_Click + End Sub \ No newline at end of file diff --git a/B4A/C_Productos.bas b/B4A/C_Productos.bas index 24139f2..aac0641 100644 --- a/B4A/C_Productos.bas +++ b/B4A/C_Productos.bas @@ -99,6 +99,7 @@ Sub Class_Globals Private l_limiteAbordoDisp As Label Dim dispAbordo As String Private l_avisoAbordo As Label + Private l_infoPedido As Label End Sub 'You can add more parameters here. @@ -162,13 +163,16 @@ Sub B4XPage_Appear ' list_prodsPedido.Initialize ' Log("list_prodsPedido.Initialize") clienteId = Subs.traeCliente + l_infoPedido.Text = "" If clienteId = 0 Then - dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, false) + dispAbordo = kh.traeDisponibleAbordo l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$ l_limiteAbordoDisp.Visible = True + l_infoPedido.Visible = True b_rmi.Visible = False Else l_limiteAbordoDisp.Visible = False + l_infoPedido.Visible = True End If rutaUsuario = Subs.traeRuta If p_rmi.Visible Then p_rmi.Visible = False @@ -191,7 +195,7 @@ Sub B4XPage_Appear query = "cat_gunaprod" query2 = "COUNT_GUNAPROD" End If - clv_prods_ll.GetBase.SetLayoutAnimated(0, 5dip, 130dip, Root.Width + 10, Root.Height * 0.68) 'Cambiamos el tamaño y posición de la lista de productos + clv_prods_ll.GetBase.SetLayoutAnimated(0, 5dip, (lfila.Top + lfila.Height), Root.Width + 10, Root.Height * 0.68) 'Cambiamos el tamaño y posición de la lista de productos clv_prods_ll.Base_Resize(clv_prods_ll.GetBase.Width, clv_prods_ll.GetBase.Height) 'Cambiamos el tamaño del panel interno de la lista para que ajuste al nuevo tamaño. If B4XPages.MainPage.bTerminarClicked Then lv_catalogos.Visible = True @@ -213,6 +217,7 @@ Sub B4XPage_Appear lv_catalogos.Visible = True p_botonesVenta.Visible = False p_botonesVenta.Top = clv_prods_ll.AsView.top + clv_prods_ll.AsView.Height - 10 + l_infoPedido.Top = p_botonesVenta.Top + p_botonesVenta.Height + 5dip lv_promos.Visible = False End If Dim label1 As Label @@ -640,7 +645,7 @@ Sub b_prodMas_Click laCant.Text = "0" et_pCant_TextChanged(100, 0) End If - dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False) + dispAbordo = kh.traeDisponibleAbordo If Subs.traeCliente = 0 And dispAbordo < 1 Then Log("######### "& NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)) laCant.Text = NumberFormat2((laCant.Text - 1), 1, 0, 0, False) @@ -704,7 +709,7 @@ Private Sub et_pCant_TextChanged (Old As String, New As String) Subs.actualizaProducto(almacenX, precioX, laCant.Text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov) ' End If Log("REVISAMOS ABORDO DISP") - dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False) + dispAbordo = kh.traeDisponibleAbordo If Subs.traeCliente = 0 And dispAbordo < 1 Then Log("######### "& NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)) laCant.Text = NumberFormat2(Old, 1, 0, 0, False) @@ -743,21 +748,35 @@ Sub cuentaProds ' Log(Subs.totalPedido) If lfila.Text = "RMI" Then l_mDisponible.Visible = True Else l_mDisponible.Visible = False l_mDisponible.Text = $"Disponible: $${Subs.totalPedido}"$ - -' Log($"${kh.traeLimiteAbordoXInventario} - ${kh.traeVenta} - ${kh.traeLimiteAbordoWeb}"$) -' Log($"LIMITE ABORDO DISPONIBLE: ${NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)}"$) - dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False) - l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$ - If dispAbordo < 1 and kh.traeCliente = 0 Then - b_continuar.Visible = False - b_terminar1.Visible = False - l_avisoAbordo.BringToFront - l_avisoAbordo.Visible = True + + Log(clienteId) + If clienteId = "0" Then + LogColor($" DispoAbordoWeb: ${kh.traeLimiteAbordoWeb}${CRLF} + Limite X Inventario: ${kh.traeLimiteAbordoXInventario}${CRLF} + Venta: ${kh.traeVenta}${CRLF} + Venta Abordo: ${kh.traeVentaAbordo} "$, Colors.red) + l_infoPedido.Text = $"LimiteAbordo: ${NumberFormat2(kh.traeLimiteAbordoWeb,1,2,1,True)} TotalInv: ${NumberFormat2(kh.traeLimiteAbordoXInventario,1,2,1,True)} + Venta: ${NumberFormat2(kh.traeVenta,1,2,1,True)} VentaAbordo: ${NumberFormat2(kh.traeVentaAbordo,1,2,1,True)} "$ +' Log($"${kh.traeLimiteAbordoXInventario} - ${kh.traeVenta} - ${kh.traeLimiteAbordoWeb}"$) +' Log($"LIMITE ABORDO DISPONIBLE: ${NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)}"$) + dispAbordo = kh.traeDisponibleAbordo + l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$ + If dispAbordo < 1 And kh.traeCliente = 0 Then + b_continuar.Visible = False + b_terminar1.Visible = False + l_avisoAbordo.BringToFront + l_avisoAbordo.Visible = True + Else + l_avisoAbordo.Visible = False + b_continuar.Visible = True + b_terminar1.Visible = True + End If Else - l_avisoAbordo.Visible = False - b_continuar.Visible = True - b_terminar1.Visible = True + Log("No ABORDO") + l_infoPedido.Text = $"Total pedido: $${kh.traeTotalCliente}"$ End If + + ' Log($"Total Prods: ${c.GetString("cant")}, Total Compra: $$1.2{c.GetString("total")}"$) c.Close End Sub diff --git a/B4A/Files/checklist.bal b/B4A/Files/checklist.bal index d05448b..68764d6 100644 Binary files a/B4A/Files/checklist.bal and b/B4A/Files/checklist.bal differ diff --git a/B4A/Files/checks.bal b/B4A/Files/checks.bal index dcf7dc3..9e0298b 100644 Binary files a/B4A/Files/checks.bal and b/B4A/Files/checks.bal differ diff --git a/B4A/Files/cliente.bal b/B4A/Files/cliente.bal index 72914a5..97f5676 100644 Binary files a/B4A/Files/cliente.bal and b/B4A/Files/cliente.bal differ diff --git a/B4A/Files/clientes.bal b/B4A/Files/clientes.bal index 25f4294..a001f51 100644 Binary files a/B4A/Files/clientes.bal and b/B4A/Files/clientes.bal differ diff --git a/B4A/Files/errormanager.bal b/B4A/Files/errormanager.bal index b7bc871..50d6f73 100644 Binary files a/B4A/Files/errormanager.bal and b/B4A/Files/errormanager.bal differ diff --git a/B4A/Files/foto.bal b/B4A/Files/foto.bal index 9afc565..0110040 100644 Binary files a/B4A/Files/foto.bal and b/B4A/Files/foto.bal differ diff --git a/B4A/Files/historico.bal b/B4A/Files/historico.bal index d98e227..0b25667 100644 Binary files a/B4A/Files/historico.bal and b/B4A/Files/historico.bal differ diff --git a/B4A/Files/login.bal b/B4A/Files/login.bal index b119ab2..260e687 100644 Binary files a/B4A/Files/login.bal and b/B4A/Files/login.bal differ diff --git a/B4A/Files/mapa_rutas.bal b/B4A/Files/mapa_rutas.bal index ff9c231..deeb8c7 100644 Binary files a/B4A/Files/mapa_rutas.bal and b/B4A/Files/mapa_rutas.bal differ diff --git a/B4A/Files/mapas.bal b/B4A/Files/mapas.bal index 6452c13..2b6907c 100644 Binary files a/B4A/Files/mapas.bal and b/B4A/Files/mapas.bal differ diff --git a/B4A/Files/nota.bal b/B4A/Files/nota.bal index b00f710..70d3175 100644 Binary files a/B4A/Files/nota.bal and b/B4A/Files/nota.bal differ diff --git a/B4A/Files/nuevocliente.bal b/B4A/Files/nuevocliente.bal index c894b2b..2c4c452 100644 Binary files a/B4A/Files/nuevocliente.bal and b/B4A/Files/nuevocliente.bal differ diff --git a/B4A/Files/principal.bal b/B4A/Files/principal.bal index 349b85e..deef6ff 100644 Binary files a/B4A/Files/principal.bal and b/B4A/Files/principal.bal differ diff --git a/B4A/Files/productos.bal b/B4A/Files/productos.bal index 9ae0ce8..43dfbf6 100644 Binary files a/B4A/Files/productos.bal and b/B4A/Files/productos.bal differ diff --git a/B4A/Files/ticketsdia.bal b/B4A/Files/ticketsdia.bal index c496d30..fdae84d 100644 Binary files a/B4A/Files/ticketsdia.bal and b/B4A/Files/ticketsdia.bal differ diff --git a/B4A/KelloggsV4.b4a b/B4A/KelloggsV4.b4a index 2756fbf..28cc14b 100644 --- a/B4A/KelloggsV4.b4a +++ b/B4A/KelloggsV4.b4a @@ -870,7 +870,7 @@ Version=12.5 #Region Project Attributes #ApplicationLabel: Kelloggs Venta #VersionCode: 3000 - #VersionName: 3.12.08 P-V4 + #VersionName: 3.12.14 P-V4 #SupportedOrientations: portrait #CanInstallToExternalStorage: False #BridgeLogger:true diff --git a/B4A/KelloggsV4.b4a.meta b/B4A/KelloggsV4.b4a.meta index 4e9a1f4..37cdd82 100644 --- a/B4A/KelloggsV4.b4a.meta +++ b/B4A/KelloggsV4.b4a.meta @@ -63,8 +63,8 @@ ModuleBreakpoints9= ModuleClosedNodes0= ModuleClosedNodes1=35 ModuleClosedNodes10= -ModuleClosedNodes11=4,50,51,52 -ModuleClosedNodes12=1 +ModuleClosedNodes11=50,51,52 +ModuleClosedNodes12= ModuleClosedNodes13= ModuleClosedNodes14=39,40,41,43,44 ModuleClosedNodes15= @@ -83,14 +83,14 @@ ModuleClosedNodes26=2 ModuleClosedNodes27= ModuleClosedNodes28=9,10,11 ModuleClosedNodes29= -ModuleClosedNodes3=86 +ModuleClosedNodes3=3,86 ModuleClosedNodes30= ModuleClosedNodes4= ModuleClosedNodes5= ModuleClosedNodes6= -ModuleClosedNodes7=3,11,12,14 +ModuleClosedNodes7=3,11,12 ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=Visual Designer,principal.bal,-100,6,C_Cliente,B4XPage_Created,304,4,C_Cliente,Initialize,298,0,Visual Designer,cliente.bal,-100,6,Visual Designer,productos.bal,-100,1,C_Principal,e_ruta_EnterPressed,2045,0,kms_helperSubs,traeCliente,615,0,kms_helperSubs,hayPedido,696,0,C_Cliente,B4XPage_Appear,394,0,C_Productos,cuentaProds,744,5 +NavigationStack=kms_helperSubs,traeCliente,613,0,kms_helperSubs,traeRuta,611,0,C_Productos,et_pCant_TextChanged,704,0,C_Productos,B4XPage_Created,143,0,kms_helperSubs,traeVentaAbordo,757,0,Visual Designer,checks.bal,-100,1,C_Productos,Class_Globals,95,0,Visual Designer,productos.bal,-100,6,C_Productos,cuentaProds,766,6,C_Productos,B4XPage_Appear,172,6 SelectedBuild=0 -VisibleModules=1,28,11,24,3,12,7,4,29 +VisibleModules=1,28,11,24,3,12,7,4,29,2 diff --git a/B4A/MAPA_RUTAS.bas b/B4A/MAPA_RUTAS.bas index 2d5aa9e..059e68b 100644 --- a/B4A/MAPA_RUTAS.bas +++ b/B4A/MAPA_RUTAS.bas @@ -105,7 +105,7 @@ Sub Activity_Create(FirstTime As Boolean) SEMANA = c.GetString("CAT_VA_VALOR") c.Close End If - p_header.Width = Activity.Width +' p_header.Width = Activity.Width p_mapa.Width = Activity.Width p_mapa.GetView(0).SetLayout(0, 0, p_mapa.Width, p_mapa.Height) End Sub diff --git a/B4A/Subs.bas b/B4A/Subs.bas index dfe6e37..e93780f 100644 --- a/B4A/Subs.bas +++ b/B4A/Subs.bas @@ -1599,7 +1599,7 @@ End Sub 'Trae la sumatoria del pedido del cliente especificado de la tabla PEDIDO. 'A veces hace el SUM() REDONDEA el monto, con esta función no se redondea nada. Sub sumaPedido(cliente As String) As String 'ignore - Dim x As Cursor = Starter.skmt.ExecQuery($"select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and pe_cliente = '${cliente}' and PE_CEDIS <> "DOE""$) + Dim x As Cursor = Starter.skmt.ExecQuery($"select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and PE_CEDIS <> "DOE" and PE_CLIENTE <> 0"$) Private total As String = 0 For i = 0 To x.RowCount - 1 x.Position = i @@ -1609,5 +1609,5 @@ Sub sumaPedido(cliente As String) As String 'ignore ' LogColor(total, Colors.Blue) Next x.Close - Return NumberFormat2(total, 0, 2, 2, False) + Return NumberFormat2(total, 1, 2, 2, False) End Sub \ No newline at end of file diff --git a/B4A/kms_helperSubs.bas b/B4A/kms_helperSubs.bas index 7b43283..523f5ff 100644 --- a/B4A/kms_helperSubs.bas +++ b/B4A/kms_helperSubs.bas @@ -615,7 +615,7 @@ Sub traeRuta(db As SQL) As String 'ignore Return r End Sub -'Regresa el cliente actual de la base de dtos (CUENTAA). +'Regresa el cliente actual de la base de datos (CUENTAA). Sub traeCliente As String 'ignore Private c As Cursor Private cl As String @@ -653,6 +653,21 @@ Sub traeTotalCliente As Double Return sumaTotal End Sub +'Regresa el TOTAL de la venta del cliente DOE. +Sub traeTotalClienteDOE As Double + Private sumaTotal As Double = 0 + Private cursorprueba As Cursor = khdb.ExecQuery2("select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS = ?", Array As String("DOE")) + For i= 0 To cursorprueba.RowCount -1 + cursorprueba.Position = i +' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red) + sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT") + sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False) +' Log(NumberFormat2(sumaTotal, 0, 2, 2, False)) + Next + cursorprueba.Close + Return sumaTotal +End Sub + 'Regresa la venta de la ruta desde pedido. Sub traeVenta As Double 'ignore Private sumatotal As Double = 0 @@ -746,6 +761,15 @@ Sub traeVentaAbordo As Double Return va End Sub +'Regresa el monto disponible para el abordo. +Sub traeDisponibleAbordo As Double +' Log("Venta abordo") + Private disp As Double = 0 + Log($"${traeLimiteAbordoWeb} - ${traeLimiteAbordoXInventario} - ${traeVentaAbordo}"$) + disp = NumberFormat2((traeLimiteAbordoWeb - (traeLimiteAbordoXInventario) - traeVentaAbordo), 0, 2, 2, False) + Return disp +End Sub + Sub string2date(fecha As String) 'ignore Log(fecha) DateTime.DateFormat = "MM/dd/yyyy"