diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index dd6868d..2d025be 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -1037,6 +1037,20 @@ Sub b_mapa_Click End Sub Sub B_IMP_Click + ' Buscamos los clientes que tienen pedido y NO estan impresos. + Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido)") + If t.RowCount > 0 Then + For i = 0 To t.RowCount - 1 + t.Position = i ' Y los BORRAMOS. + Log(t.GetString("CAT_CL_CODIGO")) + Starter.skmt.ExecNonQuery($"update CUENTAA set CUENTA = '${t.GetString("CAT_CL_CODIGO")}'"$) + Subs.borraPedidoClienteActual +' Msgbox2Async($"El pedido del cliente ${t.GetString("CAT_CL_CODIGO")} no está impreso, se va a borrar"$, "PEDIDO NO IMPRESO", "Aceptar", "", "", Null, True) + Next + End If + + Sleep(1000) + Starter.skmt.Close : Log("Cerramos BD") : Starter.revisaBD Subs.panelAnchoAlto(Panel_INV_A, Root.Width, Root.Height) Panel_INV_A.Visible = True diff --git a/B4A/C_Principal.bas b/B4A/C_Principal.bas index b48831e..75b03b3 100644 --- a/B4A/C_Principal.bas +++ b/B4A/C_Principal.bas @@ -471,22 +471,22 @@ Sub B4XPage_Appear Do While ab.NextRow If Not(abordoImpreso) Then LogColor("BORRAMOS PEDIDO DE ABORDO PORQUE NO ESTA IMPRESO", Colors.red) -' Starter.skmt.ExecNonQuery("delete from PEDIDO where PE_CLIENTE = '0'") 'Borramos el abordo si no esta impreso. - Subs.actualizaProducto(ALMACEN, 0, 0, ab.GetString("PE_PRONOMBRE"), ab.GetString("PE_PROID"), ab.GetString("PE_CLIENTE"), Subs.traeFecha, Subs.traeUsuarioDeBD, ab.GetString("PE_RUTA"), 0, ab.GetString("PE_TIPO")) +' Starter.skmt.ExecNonQuery("delete from PEDIDO where PE_CLIENTE = '0'") ''Borramos el abordo si no esta impreso. +' Subs.actualizaProducto(ALMACEN, 0, 0, ab.GetString("PE_PRONOMBRE"), ab.GetString("PE_PROID"), ab.GetString("PE_CLIENTE"), Subs.traeFecha, Subs.traeUsuarioDeBD, ab.GetString("PE_RUTA"), 0, ab.GetString("PE_TIPO")) End If Loop - ' Buscamos los clientes que tienen pedido y NO estan impresos. - Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido)") - If t.RowCount > 0 Then - For i = 0 To t.RowCount - 1 - t.Position = i ' Y los BORRAMOS. - Log(t.GetString("CAT_CL_CODIGO")) - Starter.skmt.ExecNonQuery($"update CUENTAA set CUENTA = '${t.GetString("CAT_CL_CODIGO")}'"$) - Subs.borraPedidoClienteActual - Msgbox2Async($"El pedido del cliente ${t.GetString("CAT_CL_CODIGO")} no está impreso, se va a borrar"$, "PEDIDO NO IMPRESO", "Aceptar", "", "", Null, True) - Next - End If +' ' Buscamos los clientes que tienen pedido y NO estan impresos. +' Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido)") +' If t.RowCount > 0 Then +' For i = 0 To t.RowCount - 1 +' t.Position = i ' Y los BORRAMOS. +' Log(t.GetString("CAT_CL_CODIGO")) +' Starter.skmt.ExecNonQuery($"update CUENTAA set CUENTA = '${t.GetString("CAT_CL_CODIGO")}'"$) +' Subs.borraPedidoClienteActual +' Msgbox2Async($"El pedido del cliente ${t.GetString("CAT_CL_CODIGO")} no está impreso, se va a borrar"$, "PEDIDO NO IMPRESO", "Aceptar", "", "", Null, True) +' Next +' End If ' Log("Check phone state: " & rp.Check(rp.PERMISSION_READ_PHONE_STATE)) ' Log("Pedimos permisos de estado del cel") @@ -551,6 +551,21 @@ Sub trabajar_Click End Sub Sub Subir_Click + + ' Buscamos los clientes que tienen pedido y NO estan impresos. + Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido)") + If t.RowCount > 0 Then + For i = 0 To t.RowCount - 1 + t.Position = i ' Y los BORRAMOS. + Log(t.GetString("CAT_CL_CODIGO")) + Starter.skmt.ExecNonQuery($"update CUENTAA set CUENTA = '${t.GetString("CAT_CL_CODIGO")}'"$) + Subs.borraPedidoClienteActual +' Msgbox2Async($"El pedido del cliente ${t.GetString("CAT_CL_CODIGO")} no está impreso, se va a borrar"$, "PEDIDO NO IMPRESO", "Aceptar", "", "", Null, True) + Next + End If + + Sleep(1000) + CARGA = "SUBIR" ' P1.Visible = True trabajar.Visible = False diff --git a/B4A/KelloggsV4.b4a b/B4A/KelloggsV4.b4a index ad3c66f..97de445 100644 --- a/B4A/KelloggsV4.b4a +++ b/B4A/KelloggsV4.b4a @@ -887,7 +887,7 @@ Version=12.8 #Region Project Attributes #ApplicationLabel: Kelloggs Venta #VersionCode: 3000 - #VersionName: 4.08.28 + #VersionName: 4.09.05 #SupportedOrientations: portrait #CanInstallToExternalStorage: False #BridgeLogger:true diff --git a/B4A/KelloggsV4.b4a.meta b/B4A/KelloggsV4.b4a.meta index b08b1c6..d9f06d3 100644 --- a/B4A/KelloggsV4.b4a.meta +++ b/B4A/KelloggsV4.b4a.meta @@ -76,7 +76,7 @@ ModuleClosedNodes2= ModuleClosedNodes20= ModuleClosedNodes21= ModuleClosedNodes22= -ModuleClosedNodes23=70 +ModuleClosedNodes23= ModuleClosedNodes24= ModuleClosedNodes25= ModuleClosedNodes26= @@ -91,6 +91,6 @@ ModuleClosedNodes6= ModuleClosedNodes7= ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=C_Principal,StartPrinter,2738,0,C_Cliente,B_IMP2BAK_Click,1641,0,C_Cliente,B_IMP2_Click,1119,0,C_Principal,GetResult,2786,2,EscPosPrinter,Reset,141,0,EscPosPrinter,Class_Globals,17,0,Subs,guardaProductoSin,928,0,Subs,guardaProducto,906,0,Subs,guardaProductoSinGestion,926,0,C_Cliente,Imprime_ticket,1599,6 +NavigationStack=C_Principal,Class_Globals,0,0,Diseñador Visual,principal.bal,-100,3,Diseñador Visual,cliente.bal,-100,2,C_Cliente,Class_Globals,0,0,C_Cliente,B_IMP_Click,1041,0,Subs,borraPedidoClienteActual,1487,0,C_Cliente,BP_DOE_R_Click,4168,0,C_Cliente,BP_DOE_A_Click,4163,0,C_Principal,Subir_Click,556,1,C_Principal,B4XPage_Appear,472,0 SelectedBuild=0 VisibleModules=1,28,11,3,26,23,29,12,4,13 diff --git a/B4A/kms_helperSubs.bas b/B4A/kms_helperSubs.bas index 83e07eb..244e554 100644 --- a/B4A/kms_helperSubs.bas +++ b/B4A/kms_helperSubs.bas @@ -810,12 +810,30 @@ Sub traeVentaAbordo As Double Return va End Sub +Sub TraeVentaSinImprimir As Double + ' Buscamos los clientes que tienen pedido y NO estan impresos. + Private t As Cursor = Starter.skmt.ExecQuery("Select cat_cl_codigo from kmt_info where impresion = 0 and cat_cl_codigo not in (select ci_cuenta from cliente_impreso) and cat_cl_codigo in (select distinct pe_cliente from pedido) and CAT_CL_CODIGO <> '0'") + If t.RowCount > 0 Then + Private resta As Double = 0 + For i = 0 To t.RowCount - 1 + t.Position = i + + Private m As Cursor = Starter.skmt.ExecQuery($"Select SUM(PE_COSTO_TOT) AS RESTA from PEDIDO where PE_CLIENTE = '${t.GetString("CAT_CL_CODIGO")}' "$) + m.Position = 0 + resta = resta + m.GetString("RESTA") + m.Close + + Next + End If + Return resta +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) + disp = NumberFormat2(((traeLimiteAbordoWeb - traeLimiteAbordoXInventario) - (traeVentaAbordo + TraeVentaSinImprimir)), 0, 2, 2, False) Return disp End Sub