Commit inicial.
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
**/Objects
|
||||
**/AutoBackups
|
||||
143
BUSCAR.bas
Normal file
@@ -0,0 +1,143 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim skmt As SQL
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim ListView1 As ListView
|
||||
Dim b_noventa As Button
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
Activity.LoadLayout("buscar")
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
c=skmt.ExecQuery("select REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT FROM REPARTO")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
ListView1.AddTwoLines(c.GetString("REP_CLIENTE"),c.GetString("REP_PRONOMBRE") &" Cantidad #"& c.GetString("REP_CANT")& " SubTotal $"& c.GetString("REP_COSTO_TOT"))
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
|
||||
|
||||
c=skmt.ExecQuery("select REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT FROM REPARTO")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
ListView1.AddTwoLines(c.GetString("REP_CLIENTE"),c.GetString("REP_PRONOMBRE") &" Cantidad #"& c.GetString("REP_CANT")& " SubTotal $"& c.GetString("REP_COSTO_TOT"))
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Regresar_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub b_noventa_Click
|
||||
|
||||
|
||||
c=skmt.ExecQuery("select NV_CLIENTE,NV_MOTIVO,NV_COMM FROM NOVENTA ORDER BY NV_CLIENTE asc")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
ListView1.AddTwoLines(c.GetString("NV_CLIENTE"),"Motivo #"& c.GetString("NV_MOTIVO")& " Comentario $"& c.GetString("NV_COMM"))
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
126
BatteryUtilities.bas
Normal file
@@ -0,0 +1,126 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=10.2
|
||||
@EndOfDesignText@
|
||||
'Class module
|
||||
Sub Class_Globals
|
||||
Private nativeMe As JavaObject
|
||||
|
||||
End Sub
|
||||
'Initializes the object.
|
||||
Public Sub Initialize
|
||||
nativeMe = Me
|
||||
End Sub
|
||||
'Return information about the battery status. It returns the following 11 values in an integer Array:
|
||||
'EXTRA_LEVEL = current battery level, from 0 To EXTRA_SCALE.
|
||||
'EXTRA_SCALE = the maximum battery level possible.
|
||||
'EXTRA_HEALTH = the current health constant.
|
||||
'EXTRA_ICON_SMALL = the resource ID of a small status bar icon indicating the current battery state.
|
||||
'EXTRA_PLUGGED = whether the device is plugged into a Power source; 0 means it is on battery, other constants are different types of Power sources.
|
||||
'EXTRA_STATUS = the current status constant.
|
||||
'EXTRA_TEMPERATURE = the current battery temperature.
|
||||
'EXTRA_VOLTAGE = the current battery voltage level.
|
||||
'A value indicating if the battery is being charged or fully charged (If neither it returns 0 Else it returns 1)
|
||||
'A value indicating if it is charging via USB (0 = Not USB, 2 = USB)
|
||||
'A value indicating if it is charging via AC (0 = Not AC, 1 = AC)
|
||||
Public Sub getBatteryInformation () As Int()
|
||||
|
||||
Dim batteryInfo(11) As Int
|
||||
batteryInfo = nativeMe.RunMethod("getBatteryInformation",Null)
|
||||
Return batteryInfo
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub getBatteryTechnolgy() As String
|
||||
|
||||
Dim batterytech As String
|
||||
batterytech = nativeMe.RunMethod("getBatteryTechnology",Null)
|
||||
Return batterytech
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
#If Java
|
||||
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Bundle;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
|
||||
public int[] getBatteryInformation() {
|
||||
|
||||
int[] mybat = new int[11];
|
||||
|
||||
Intent batteryIntent = ba.context.getApplicationContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
|
||||
int level = batteryIntent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
|
||||
mybat[0] = level;
|
||||
int scale = batteryIntent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
|
||||
mybat[1] = scale;
|
||||
int health = batteryIntent.getIntExtra(BatteryManager.EXTRA_HEALTH,-1);
|
||||
mybat[2] = health;
|
||||
int icon_small = batteryIntent.getIntExtra(BatteryManager.EXTRA_ICON_SMALL,-1);
|
||||
mybat[3] = icon_small;
|
||||
int plugged = batteryIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED,-1);
|
||||
mybat[4] = plugged;
|
||||
// boolean present = batteryIntent.getExtras().getBoolean(BatteryManager.EXTRA_PRESENT);
|
||||
int status = batteryIntent.getIntExtra(BatteryManager.EXTRA_STATUS,-1);
|
||||
mybat[5] = status;
|
||||
// String technology = batteryIntent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY);
|
||||
// BA.Log("Technology = " + technology);
|
||||
int temperature = batteryIntent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE,-1);
|
||||
mybat[6] = temperature;
|
||||
int voltage = batteryIntent.getIntExtra(BatteryManager.EXTRA_VOLTAGE,-1);
|
||||
mybat[7] = voltage;
|
||||
// int ac = batteryIntent.getIntExtra("plugged",BatteryManager.BATTERY_PLUGGED_AC);
|
||||
// mybat[8] = ac;
|
||||
// int usb = batteryIntent.getIntExtra("plugged",BatteryManager.BATTERY_PLUGGED_USB);
|
||||
// mybat[9] = usb;
|
||||
|
||||
boolean isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
|
||||
status == BatteryManager.BATTERY_STATUS_FULL;
|
||||
mybat[8] = 0;
|
||||
if (isCharging == true) {
|
||||
mybat[8] = 1;
|
||||
}
|
||||
|
||||
// How are we charging?
|
||||
mybat[9] = 0;
|
||||
mybat[10] = 0;
|
||||
int chargePlug = batteryIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1);
|
||||
boolean usbCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_USB;
|
||||
if (usbCharge == true) {
|
||||
mybat[9] = 2;
|
||||
}
|
||||
|
||||
boolean acCharge = chargePlug == BatteryManager.BATTERY_PLUGGED_AC;
|
||||
if (acCharge == true) {
|
||||
mybat[10] = 1;
|
||||
}
|
||||
|
||||
return mybat;
|
||||
}
|
||||
|
||||
|
||||
public String getBatteryTechnology() {
|
||||
|
||||
Intent batteryIntent = ba.context.getApplicationContext().registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
|
||||
String technology = batteryIntent.getExtras().getString(BatteryManager.EXTRA_TECHNOLOGY);
|
||||
|
||||
return technology;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End If
|
||||
290
CameraExClass.bas
Normal file
@@ -0,0 +1,290 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
|
||||
'Class module
|
||||
'version 1.20
|
||||
'See this page for the list of constants:
|
||||
'http://developer.android.com/intl/fr/reference/android/hardware/Camera.Parameters.html
|
||||
'Note that you should use the constant values instead of the names.
|
||||
Sub Class_Globals
|
||||
Private nativeCam As Object
|
||||
Private cam As Camera
|
||||
Private r As Reflector
|
||||
Private target As Object
|
||||
Private event As String
|
||||
Public Front As Boolean
|
||||
Type CameraInfoAndId (CameraInfo As Object, Id As Int)
|
||||
Type CameraSize (Width As Int, Height As Int)
|
||||
Private parameters As Object
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize (Panel1 As Panel, FrontCamera As Boolean, TargetModule As Object, EventName As String)
|
||||
target = TargetModule
|
||||
event = EventName
|
||||
Front = FrontCamera
|
||||
Dim id As Int
|
||||
id = FindCamera(Front).id
|
||||
If id = -1 Then
|
||||
Front = Not(Front) 'try different camera
|
||||
id = FindCamera(Front).id
|
||||
If id = -1 Then
|
||||
ToastMessageShow("No camera found.", True)
|
||||
Return
|
||||
End If
|
||||
End If
|
||||
cam.Initialize2(Panel1, "camera", id)
|
||||
End Sub
|
||||
|
||||
Private Sub FindCamera (frontCamera As Boolean) As CameraInfoAndId
|
||||
Dim ci As CameraInfoAndId
|
||||
Dim cameraInfo As Object
|
||||
Dim cameraValue As Int
|
||||
If frontCamera Then cameraValue = 1 Else cameraValue = 0
|
||||
cameraInfo = r.CreateObject("android.hardware.Camera$CameraInfo")
|
||||
Dim numberOfCameras As Int = r.RunStaticMethod("android.hardware.Camera", "getNumberOfCameras", Null, Null)
|
||||
For i = 0 To numberOfCameras - 1
|
||||
r.RunStaticMethod("android.hardware.Camera", "getCameraInfo", Array As Object(i, cameraInfo), _
|
||||
Array As String("java.lang.int", "android.hardware.Camera$CameraInfo"))
|
||||
r.target = cameraInfo
|
||||
If r.GetField("facing") = cameraValue Then
|
||||
ci.cameraInfo = r.target
|
||||
ci.Id = i
|
||||
Return ci
|
||||
End If
|
||||
Next
|
||||
ci.id = -1
|
||||
Return ci
|
||||
End Sub
|
||||
|
||||
Private Sub SetDisplayOrientation
|
||||
r.target = r.GetActivity
|
||||
r.target = r.RunMethod("getWindowManager")
|
||||
r.target = r.RunMethod("getDefaultDisplay")
|
||||
r.target = r.RunMethod("getRotation")
|
||||
Dim previewResult, result, degrees As Int = r.target * 90
|
||||
Dim ci As CameraInfoAndId = FindCamera(Front)
|
||||
r.target = ci.CameraInfo
|
||||
Dim orientation As Int = r.GetField("orientation")
|
||||
If Front Then
|
||||
previewResult = (orientation + degrees) Mod 360
|
||||
result = previewResult
|
||||
previewResult = (360 - previewResult) Mod 360
|
||||
Else
|
||||
previewResult = (orientation - degrees + 360) Mod 360
|
||||
result = previewResult
|
||||
Log(previewResult)
|
||||
End If
|
||||
r.target = nativeCam
|
||||
r.RunMethod2("setDisplayOrientation", previewResult, "java.lang.int")
|
||||
r.target = parameters
|
||||
r.RunMethod2("setRotation", result, "java.lang.int")
|
||||
CommitParameters
|
||||
End Sub
|
||||
|
||||
Private Sub Camera_Ready (Success As Boolean)
|
||||
If Success Then
|
||||
r.target = cam
|
||||
nativeCam = r.GetField("camera")
|
||||
r.target = nativeCam
|
||||
parameters = r.RunMethod("getParameters")
|
||||
SetDisplayOrientation
|
||||
Else
|
||||
Log("success = false, " & LastException)
|
||||
End If
|
||||
CallSub2(target, event & "_ready", Success)
|
||||
End Sub
|
||||
|
||||
Sub Camera_Preview (Data() As Byte)
|
||||
If SubExists(target, event & "_preview") Then
|
||||
CallSub2(target, event & "_preview", Data)
|
||||
End If
|
||||
End Sub
|
||||
Public Sub TakePicture
|
||||
cam.TakePicture
|
||||
End Sub
|
||||
|
||||
Private Sub Camera_PictureTaken (Data() As Byte)
|
||||
CallSub2(target, event & "_PictureTaken", Data)
|
||||
End Sub
|
||||
|
||||
Public Sub StartPreview
|
||||
cam.StartPreview
|
||||
End Sub
|
||||
|
||||
Public Sub StopPreview
|
||||
cam.StopPreview
|
||||
End Sub
|
||||
|
||||
Public Sub Release
|
||||
cam.Release
|
||||
End Sub
|
||||
|
||||
'Saves the data received from PictureTaken event
|
||||
Public Sub SavePictureToFile(Data() As Byte, Dir As String, FileName As String)
|
||||
Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
|
||||
out.WriteBytes(Data, 0, Data.Length)
|
||||
out.Close
|
||||
End Sub
|
||||
|
||||
Public Sub SetParameter(Key As String, Value As String)
|
||||
r.target = parameters
|
||||
r.RunMethod3("set", Key, "java.lang.String", Value, "java.lang.String")
|
||||
End Sub
|
||||
|
||||
Public Sub GetParameter(Key As String) As String
|
||||
r.target = parameters
|
||||
Return r.RunMethod2("get", Key, "java.lang.String")
|
||||
End Sub
|
||||
|
||||
Public Sub CommitParameters
|
||||
Try
|
||||
r.target = nativeCam
|
||||
r.RunMethod4("setParameters", Array As Object(parameters), Array As String("android.hardware.Camera$Parameters"))
|
||||
Catch
|
||||
ToastMessageShow("Error setting parameters.", True)
|
||||
Log(LastException)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub GetColorEffect As String
|
||||
Return GetParameter("effect")
|
||||
End Sub
|
||||
|
||||
Public Sub SetColorEffect(Effect As String)
|
||||
SetParameter("effect", Effect)
|
||||
End Sub
|
||||
|
||||
Public Sub GetSupportedPicturesSizes As CameraSize()
|
||||
r.target = parameters
|
||||
Dim list1 As List = r.RunMethod("getSupportedPictureSizes")
|
||||
Dim cs(list1.Size) As CameraSize
|
||||
For i = 0 To list1.Size - 1
|
||||
r.target = list1.Get(i)
|
||||
cs(i).Width = r.GetField("width")
|
||||
cs(i).Height = r.GetField("height")
|
||||
Next
|
||||
Return cs
|
||||
End Sub
|
||||
|
||||
Public Sub SetPictureSize(Width As Int, Height As Int)
|
||||
r.target = parameters
|
||||
r.RunMethod3("setPictureSize", Width, "java.lang.int", Height, "java.lang.int")
|
||||
End Sub
|
||||
|
||||
Public Sub SetJpegQuality(Quality As Int)
|
||||
r.target = parameters
|
||||
r.RunMethod2("setJpegQuality", Quality, "java.lang.int")
|
||||
End Sub
|
||||
|
||||
Public Sub SetFlashMode(Mode As String)
|
||||
r.target = parameters
|
||||
r.RunMethod2("setFlashMode", Mode, "java.lang.String")
|
||||
End Sub
|
||||
|
||||
Public Sub GetFlashMode As String
|
||||
r.target = parameters
|
||||
Return r.RunMethod("getFlashMode")
|
||||
End Sub
|
||||
|
||||
Public Sub GetSupportedFlashModes As List
|
||||
r.target = parameters
|
||||
Return r.RunMethod("getSupportedFlashModes")
|
||||
End Sub
|
||||
|
||||
Public Sub GetSupportedColorEffects As List
|
||||
r.target = parameters
|
||||
Return r.RunMethod("getSupportedColorEffects")
|
||||
End Sub
|
||||
|
||||
Public Sub GetPreviewSize As CameraSize
|
||||
r.target = parameters
|
||||
r.target = r.RunMethod("getPreviewSize")
|
||||
Dim cs As CameraSize
|
||||
cs.Width = r.GetField("width")
|
||||
cs.Height = r.GetField("height")
|
||||
Return cs
|
||||
End Sub
|
||||
|
||||
Public Sub GetPictureSize As CameraSize
|
||||
r.target = parameters
|
||||
r.target = r.RunMethod("getPictureSize")
|
||||
Dim cs As CameraSize
|
||||
cs.Width = r.GetField("width")
|
||||
cs.Height = r.GetField("height")
|
||||
Return cs
|
||||
End Sub
|
||||
|
||||
'Converts a preview image formatted in YUV format to JPEG.
|
||||
'Note that you should not save every preview image as it will slow down the whole process.
|
||||
Public Sub PreviewImageToJpeg(data() As Byte, quality As Int) As Byte()
|
||||
Dim size, previewFormat As Object
|
||||
r.target = parameters
|
||||
size = r.RunMethod("getPreviewSize")
|
||||
previewFormat = r.RunMethod("getPreviewFormat")
|
||||
r.target = size
|
||||
Dim width = r.GetField("width"), height = r.GetField("height") As Int
|
||||
Dim yuvImage As Object = r.CreateObject2("android.graphics.YuvImage", _
|
||||
Array As Object(data, previewFormat, width, height, Null), _
|
||||
Array As String("[B", "java.lang.int", "java.lang.int", "java.lang.int", "[I"))
|
||||
r.target = yuvImage
|
||||
Dim rect1 As Rect
|
||||
rect1.Initialize(0, 0, r.RunMethod("getWidth"), r.RunMethod("getHeight"))
|
||||
Dim out As OutputStream
|
||||
out.InitializeToBytesArray(100)
|
||||
r.RunMethod4("compressToJpeg", Array As Object(rect1, quality, out), _
|
||||
Array As String("android.graphics.Rect", "java.lang.int", "java.io.OutputStream"))
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
|
||||
Public Sub GetSupportedFocusModes As List
|
||||
r.target = parameters
|
||||
Return r.RunMethod("getSupportedFocusModes")
|
||||
End Sub
|
||||
|
||||
Public Sub SetContinuousAutoFocus
|
||||
Dim modes As List = GetSupportedFocusModes
|
||||
If modes.IndexOf("continuous-picture") > -1 Then
|
||||
SetFocusMode("continuous-picture")
|
||||
Else If modes.IndexOf("continuous-video") > -1 Then
|
||||
SetFocusMode("continuous-video")
|
||||
Else
|
||||
Log("Continuous focus mode is not available")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub SetFocusMode(Mode As String)
|
||||
r.target = parameters
|
||||
r.RunMethod2("setFocusMode", Mode, "java.lang.String")
|
||||
End Sub
|
||||
|
||||
Public Sub GetFocusDistances As Float()
|
||||
Dim F(3) As Float
|
||||
r.target = parameters
|
||||
r.RunMethod4("getFocusDistances", Array As Object(F), Array As String("[F"))
|
||||
Return F
|
||||
End Sub
|
||||
'This method should only be called if you need to immediately release the camera.
|
||||
'For example if you need to start another application that depends on the camera.
|
||||
Public Sub CloseNow
|
||||
cam.Release
|
||||
r.target = cam
|
||||
r.RunMethod2("releaseCameras", True, "java.lang.boolean")
|
||||
End Sub
|
||||
'Calls AutoFocus and then takes the picture if focus was successfull.
|
||||
Public Sub FocusAndTakePicture
|
||||
cam.AutoFocus
|
||||
End Sub
|
||||
Private Sub Camera_FocusDone (Success As Boolean)
|
||||
If Success Then
|
||||
TakePicture
|
||||
Else
|
||||
Log("AutoFocus error.")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
267
DBRequestManager.bas
Normal file
@@ -0,0 +1,267 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
'Class module
|
||||
Sub Class_Globals
|
||||
Private mTarget As Object
|
||||
Type DBResult (Tag As Object, Columns As Map, Rows As List)
|
||||
Type DBCommand (Name As String, Parameters() As Object)
|
||||
Private link As String
|
||||
Private bc As ByteConverter
|
||||
Private T_NULL = 0, T_STRING = 1, T_SHORT = 2, T_INT = 3, T_LONG = 4, T_FLOAT = 5 _
|
||||
,T_DOUBLE = 6, T_BOOLEAN = 7, T_BLOB = 8 As Byte
|
||||
Private VERSION As Float = 0.9
|
||||
Private tempArray(1) As Object
|
||||
End Sub
|
||||
|
||||
'Target - The module that handles JobDone (usually Me).
|
||||
'ConnectorLink - URL of the Java server.
|
||||
Public Sub Initialize (Target As Object, ConnectorLink As String)
|
||||
mTarget = Target
|
||||
link = ConnectorLink
|
||||
End Sub
|
||||
|
||||
'Sends a query request.
|
||||
'Command - Query name and parameters.
|
||||
'Limit - Maximum rows to return or 0 for no limit.
|
||||
'Tag - An object that will be returned in the result.
|
||||
Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteInt(Limit, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
out2.Close
|
||||
j.PostBytes(link & "?method=query", ms.ToBytesArray)
|
||||
End Sub
|
||||
|
||||
'Executes a batch of (non-select) commands.
|
||||
'ListOfCommands - List of the commands that will be executes.
|
||||
'Tag - An object that will be returned in the result.
|
||||
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
WriteInt(ListOfCommands.Size, out2)
|
||||
For Each Command As DBCommand In ListOfCommands
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteList(Command.Parameters, out2)
|
||||
Next
|
||||
out2.Close
|
||||
j.PostBytes(link & "?method=batch", ms.ToBytesArray)
|
||||
End Sub
|
||||
|
||||
'Similar to ExecuteBatch. Sends a single command.
|
||||
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||
End Sub
|
||||
|
||||
Private Sub StartJob(j As HttpJob, MemoryStream As OutputStream, Tag As Object) As OutputStream
|
||||
j.Initialize("DBRequest", mTarget)
|
||||
j.Tag = Tag
|
||||
MemoryStream.InitializeToBytesArray(0)
|
||||
Dim compress As CompressedStreams
|
||||
Dim out As OutputStream = compress.WrapOutputStream(MemoryStream, "gzip")
|
||||
WriteObject(VERSION, out)
|
||||
Return out
|
||||
End Sub
|
||||
|
||||
Private Sub WriteList(Parameters As List, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
If Parameters = Null Or Parameters.IsInitialized = False Then
|
||||
Dim Parameters As List
|
||||
Parameters.Initialize
|
||||
End If
|
||||
data = bc.IntsToBytes(Array As Int(Parameters.Size))
|
||||
out.WriteBytes(data, 0, data.Length)
|
||||
For Each o As Object In Parameters
|
||||
WriteObject(o, out)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub WriteObject(o As Object, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
tempArray(0) = o
|
||||
If tempArray(0) = Null Then
|
||||
out.WriteBytes(Array As Byte(T_NULL), 0, 1)
|
||||
Else If tempArray(0) Is Short Then
|
||||
out.WriteBytes(Array As Byte(T_SHORT), 0, 1)
|
||||
data = bc.ShortsToBytes(Array As Short(o))
|
||||
Else If tempArray(0) Is Int Then
|
||||
out.WriteBytes(Array As Byte(T_INT), 0, 1)
|
||||
data = bc.IntsToBytes(Array As Int(o))
|
||||
Else If tempArray(0) Is Float Then
|
||||
out.WriteBytes(Array As Byte(T_FLOAT), 0, 1)
|
||||
data = bc.FloatsToBytes(Array As Float(o))
|
||||
Else If tempArray(0) Is Double Then
|
||||
out.WriteBytes(Array As Byte(T_DOUBLE), 0, 1)
|
||||
data = bc.DoublesToBytes(Array As Double(o))
|
||||
Else If tempArray(0) Is Long Then
|
||||
out.WriteBytes(Array As Byte(T_LONG), 0, 1)
|
||||
data = bc.LongsToBytes(Array As Long(o))
|
||||
Else If tempArray(0) Is Boolean Then
|
||||
out.WriteBytes(Array As Byte(T_BOOLEAN), 0, 1)
|
||||
Dim b As Boolean = 0
|
||||
Dim data(1) As Byte
|
||||
If b Then data(0) = 1 Else data(0) = 0
|
||||
Else If GetType(tempArray(0)) = "[B" Then
|
||||
data = o
|
||||
out.WriteBytes(Array As Byte(T_BLOB), 0, 1)
|
||||
WriteInt(data.Length, out)
|
||||
Else 'If o Is String Then (treat all other values as string)
|
||||
out.WriteBytes(Array As Byte(T_STRING), 0, 1)
|
||||
data = bc.StringToBytes(o, "UTF8")
|
||||
WriteInt(data.Length, out)
|
||||
End If
|
||||
If data.Length > 0 Then out.WriteBytes(data, 0, data.Length)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadObject(In As InputStream) As Object
|
||||
Dim data(1) As Byte
|
||||
In.ReadBytes(data, 0, 1)
|
||||
Select data(0)
|
||||
Case T_NULL
|
||||
Return Null
|
||||
Case T_SHORT
|
||||
Dim data(2) As Byte
|
||||
Return bc.ShortsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_INT
|
||||
Dim data(4) As Byte
|
||||
Return bc.IntsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_LONG
|
||||
Dim data(8) As Byte
|
||||
Return bc.LongsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_FLOAT
|
||||
Dim data(4) As Byte
|
||||
Return bc.FloatsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_DOUBLE
|
||||
Dim data(8) As Byte
|
||||
Return bc.DoublesFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
Case T_BOOLEAN
|
||||
Dim b As Byte = ReadByte(In)
|
||||
Return b = 1
|
||||
Case T_BLOB
|
||||
Dim len As Int = ReadInt(In)
|
||||
Dim data(len) As Byte
|
||||
Return ReadBytesFully(In, data, data.Length)
|
||||
Case Else
|
||||
Dim len As Int = ReadInt(In)
|
||||
Dim data(len) As Byte
|
||||
ReadBytesFully(In, data, data.Length)
|
||||
Return BytesToString(data, 0, data.Length, "UTF8")
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub ReadBytesFully(In As InputStream, Data() As Byte, Len As Int) As Byte()
|
||||
Dim count = 0, read As Int
|
||||
Do While count < Len And read > -1
|
||||
read = In.ReadBytes(Data, count, Len - count)
|
||||
count = count + read
|
||||
Loop
|
||||
Return Data
|
||||
End Sub
|
||||
|
||||
Private Sub WriteInt(i As Int, out As OutputStream)
|
||||
Dim data() As Byte
|
||||
data = bc.IntsToBytes(Array As Int(i))
|
||||
out.WriteBytes(data, 0, data.Length)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadInt(In As InputStream) As Int
|
||||
Dim data(4) As Byte
|
||||
Return bc.IntsFromBytes(ReadBytesFully(In, data, data.Length))(0)
|
||||
End Sub
|
||||
|
||||
Private Sub ReadByte(In As InputStream) As Byte
|
||||
Dim data(1) As Byte
|
||||
In.ReadBytes(data, 0, 1)
|
||||
Return data(0)
|
||||
End Sub
|
||||
|
||||
'Handles the Job result and returns a DBResult.
|
||||
Public Sub HandleJob(Job As HttpJob) As DBResult
|
||||
Dim start As Long = DateTime.Now
|
||||
Dim In As InputStream = Job.GetInputStream
|
||||
Dim cs As CompressedStreams
|
||||
In = cs.WrapInputStream(In, "gzip")
|
||||
Dim serverVersion As Float = ReadObject(In) 'ignore
|
||||
Dim method As String = ReadObject(In)
|
||||
Dim table As DBResult
|
||||
table.Initialize
|
||||
table.Columns.Initialize
|
||||
table.rows.Initialize
|
||||
table.Tag = Job.Tag
|
||||
If method = "query" Then
|
||||
Dim numberOfColumns As Int = ReadInt(In)
|
||||
For i = 0 To numberOfColumns - 1
|
||||
table.Columns.Put(ReadObject(In), i)
|
||||
Next
|
||||
Do While ReadByte(In) = 1
|
||||
Dim rowObjects(numberOfColumns) As Object
|
||||
table.rows.Add(rowObjects)
|
||||
For col = 0 To numberOfColumns - 1
|
||||
Dim o As Object = ReadObject(In)
|
||||
rowObjects(col) = o
|
||||
Next
|
||||
Loop
|
||||
Else If method = "batch" Then
|
||||
table.Columns.Put("AffectedRows", 0)
|
||||
Dim rows As Int = ReadInt(In)
|
||||
For i = 0 To rows - 1
|
||||
table.rows.Add(Array As Object(ReadInt(In)))
|
||||
Next
|
||||
End If
|
||||
In.Close
|
||||
Log("HandleJob: " & (DateTime.Now - start))
|
||||
Return table
|
||||
End Sub
|
||||
'Reads a file and returns the file as a bytes array.
|
||||
Public Sub FileToBytes(Dir As String, FileName As String) As Byte()
|
||||
Dim out As OutputStream
|
||||
out.InitializeToBytesArray(0)
|
||||
Dim In As InputStream = File.OpenInput(Dir, FileName)
|
||||
File.Copy2(In, out)
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
'Converts an image to a bytes array (for BLOB fields).
|
||||
Public Sub ImageToBytes(Image As Bitmap) As Byte()
|
||||
Dim out As OutputStream
|
||||
out.InitializeToBytesArray(0)
|
||||
Image.WriteToStream(out, 100, "JPEG")
|
||||
out.Close
|
||||
Return out.ToBytesArray
|
||||
End Sub
|
||||
'Converts a bytes array to an image (for BLOB fields).
|
||||
Public Sub BytesToImage(bytes() As Byte) As Bitmap
|
||||
Dim In As InputStream
|
||||
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
|
||||
Dim bmp As Bitmap
|
||||
bmp.Initialize2(In)
|
||||
Return bmp
|
||||
End Sub
|
||||
'Prints the table to the logs.
|
||||
Public Sub PrintTable(Table As DBResult)
|
||||
Log("Tag: " & Table.Tag & ", Columns: " & Table.Columns.Size & ", Rows: " & Table.Rows.Size)
|
||||
Dim sb As StringBuilder
|
||||
sb.Initialize
|
||||
For Each col In Table.Columns.Keys
|
||||
sb.Append(col).Append(TAB)
|
||||
Next
|
||||
Log(sb.ToString)
|
||||
For Each row() As Object In Table.Rows
|
||||
Dim sb As StringBuilder
|
||||
sb.Initialize
|
||||
For Each record As Object In row
|
||||
sb.Append(record).Append(TAB)
|
||||
Next
|
||||
ToastMessageShow(sb.ToString, True)
|
||||
Next
|
||||
End Sub
|
||||
|
||||
|
||||
359
Durakelo_reparto.b4a
Normal file
@@ -0,0 +1,359 @@
|
||||
Build1=Default,dreparto.keymon.com.mx
|
||||
File1=alert2.png
|
||||
File10=guna_viejo.png
|
||||
File11=info_gral.bal
|
||||
File12=infonavit1.jpg
|
||||
File13=itembuttonblue.png
|
||||
File14=keymon_logo.png
|
||||
File15=kmt.db
|
||||
File16=login.bal
|
||||
File17=LOGO SANFER.jpg
|
||||
File18=logo_exitus1.jpg
|
||||
File19=Malo.jpg
|
||||
File2=alerta.jpg
|
||||
File20=mapa.bal
|
||||
File21=mapa_rutas.bal
|
||||
File22=nopago.bal
|
||||
File23=nuevocliente.bal
|
||||
File24=pedido.bal
|
||||
File25=planfia_logo.png
|
||||
File26=planfia_logo_old.png
|
||||
File27=planfia_logo_old2.png
|
||||
File28=seleccion.bal
|
||||
File29=sync.png
|
||||
File3=buscar.bal
|
||||
File30=tarjeta.bal
|
||||
File31=telefonos.bal
|
||||
File4=detalle_promo.bal
|
||||
File5=durakelo1.png
|
||||
File6=fila.bal
|
||||
File7=fondo_kmt.jpg
|
||||
File8=foto.bal
|
||||
File9=guardagestion.bal
|
||||
FileGroup1=Default Group
|
||||
FileGroup10=Default Group
|
||||
FileGroup11=Default Group
|
||||
FileGroup12=Default Group
|
||||
FileGroup13=Default Group
|
||||
FileGroup14=Default Group
|
||||
FileGroup15=Default Group
|
||||
FileGroup16=Default Group
|
||||
FileGroup17=Default Group
|
||||
FileGroup18=Default Group
|
||||
FileGroup19=Default Group
|
||||
FileGroup2=Default Group
|
||||
FileGroup20=Default Group
|
||||
FileGroup21=Default Group
|
||||
FileGroup22=Default Group
|
||||
FileGroup23=Default Group
|
||||
FileGroup24=Default Group
|
||||
FileGroup25=Default Group
|
||||
FileGroup26=Default Group
|
||||
FileGroup27=Default Group
|
||||
FileGroup28=Default Group
|
||||
FileGroup29=Default Group
|
||||
FileGroup3=Default Group
|
||||
FileGroup30=Default Group
|
||||
FileGroup31=Default Group
|
||||
FileGroup4=Default Group
|
||||
FileGroup5=Default Group
|
||||
FileGroup6=Default Group
|
||||
FileGroup7=Default Group
|
||||
FileGroup8=Default Group
|
||||
FileGroup9=Default Group
|
||||
Group=Default Group
|
||||
Library1=baqrcode
|
||||
Library10=gps
|
||||
Library11=javaobject
|
||||
Library12=phone
|
||||
Library13=randomaccessfile
|
||||
Library14=reflection
|
||||
Library15=runtimepermissions
|
||||
Library16=serial
|
||||
Library17=sql
|
||||
Library18=togglelibrary
|
||||
Library19=zxing_scanner
|
||||
Library2=batteryprogressview
|
||||
Library20=okhttputils2
|
||||
Library3=bitmapcreator
|
||||
Library4=byteconverter
|
||||
Library5=camera
|
||||
Library6=core
|
||||
Library7=fusedlocationprovider
|
||||
Library8=googlemaps
|
||||
Library9=googlemapsextras
|
||||
ManifestCode='This code will be applied to the manifest file during compilation.~\n~'You do not need to modify it in most cases.~\n~'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136~\n~AddManifestText(~\n~<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="28"/>~\n~<supports-screens android:largeScreens="true" ~\n~ android:normalScreens="true" ~\n~ android:smallScreens="true" ~\n~ android:anyDensity="true"/>)~\n~SetApplicationAttribute(android:icon, "@drawable/icon")~\n~SetApplicationAttribute(android:label, "$LABEL$")~\n~AddApplicationText(<activity android:name="com.google.zxing.client.android.CaptureActivity"~\n~android:screenOrientation="landscape" ~\n~android:configChanges="orientation|keyboardHidden"~\n~android:theme="@android:style/Theme.NoTitleBar.Fullscreen"~\n~android:windowSoftInputMode="stateAlwaysHidden">~\n~</activity>)~\n~AddManifestText(~\n~<uses-permission~\n~ android:name="android.permission.READ_PHONE_STATE"~\n~ android:maxSdkVersion="19" />~\n~)~\n~AddApplicationText(~\n~<meta-data~\n~ android:name="com.google.android.geo.API_KEY"~\n~ android:value="AIzaSyBlBnx3O-DncOSv3oFIp-12wgujOYYcl-U"/>~\n~ <meta-data android:name="com.google.android.gms.version"~\n~ android:value="@integer/google_play_services_version" />~\n~)~\n~AddManifestText(~\n~<uses-permission~\n~ android:name="android.permission.WRITE_EXTERNAL_STORAGE"~\n~ android:maxSdkVersion="19" />~\n~)~\n~'''' para el teclado~\n~ SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)~\n~SetServiceAttribute(Tracker, android:foregroundServiceType, "location")~\n~~\n~~\n~~\n~
|
||||
Module1=BatteryUtilities
|
||||
Module10=gestion
|
||||
Module11=Historico
|
||||
Module12=MAPA_RUTAS
|
||||
Module13=mapas
|
||||
Module14=nopago
|
||||
Module15=nuevocliente
|
||||
Module16=pedidos
|
||||
Module17=seleccion
|
||||
Module18=Starter
|
||||
Module19=tarjeta
|
||||
Module2=BUSCAR
|
||||
Module20=telefonos
|
||||
Module21=Tracker
|
||||
Module3=CameraExClass
|
||||
Module4=colonia
|
||||
Module5=colonia2
|
||||
Module6=DBRequestManager
|
||||
Module7=detalle_promo
|
||||
Module8=fila
|
||||
Module9=foto
|
||||
NumberOfFiles=31
|
||||
NumberOfLibraries=20
|
||||
NumberOfModules=21
|
||||
Version=12.5
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Durakelo-Reparto
|
||||
#VersionCode: 1
|
||||
#VersionName:
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
#AdditionalJar: com.android.support:support-v4
|
||||
#AdditionalJar: com.google.android.gms:play-services-location
|
||||
#BridgeLogger: true
|
||||
'###########################################################################################################
|
||||
'###################### PULL #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=git&Args=pull
|
||||
'###########################################################################################################
|
||||
'###################### PUSH #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=github&Args=..\..\
|
||||
'###########################################################################################################
|
||||
'###################### PUSH TORTOISE GIT #########################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe&Args=TortoiseGitProc&Args=/command:commit&Args=/path:"./../"&Args=/closeonend:2
|
||||
'###########################################################################################################
|
||||
#End Region
|
||||
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
#Region Service Attributes
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim ruta As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
Dim skmt As SQL
|
||||
Dim batt As String
|
||||
Dim usuario As String
|
||||
Dim server As String
|
||||
Dim montoActual, montorechazo,montosalida, clientesTotal, clientesVenta, clientesVisitados,almacen, rutaPreventa As String
|
||||
Dim ultimaActualizacionGPS As String = 235959
|
||||
Dim logger As Boolean
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim skmt As SQL
|
||||
Dim user As EditText
|
||||
Dim pass As EditText
|
||||
Dim c As Cursor
|
||||
Dim existe As String
|
||||
Dim paso1 As String
|
||||
Private IMEN As Label
|
||||
Dim IMEI As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
logger = True
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
' server = "http://10.0.0.205:1782"
|
||||
server = "http://keymon.lat:1782"
|
||||
|
||||
If FirstTime Then
|
||||
' reqManager.Initialize(Me,"http://201.99.139.28:1782")
|
||||
' reqManager.Initialize(Me,"http://177.244.63.54:1782")
|
||||
reqManager.Initialize(Me,server)
|
||||
' "http://keymon.com.mx:1782"
|
||||
End If
|
||||
Activity.LoadLayout("login")
|
||||
Dim P As PhoneId
|
||||
IMEN.Text = P.GetDeviceId
|
||||
IMEI = P.GetDeviceId
|
||||
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS RUTAA (RUTAA TEXT)")
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
If Result Then
|
||||
StartService(Tracker)
|
||||
Log("Start Tracker")
|
||||
Else
|
||||
ToastMessageShow("No permission", True)
|
||||
End If
|
||||
dameUsuario 'Obtenemos el usuario registrado
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Entrar_Click
|
||||
If pass.Text = "YA" Then
|
||||
|
||||
skmt.ExecNonQuery("delete from usuarioa")
|
||||
|
||||
skmt.ExecNonQuery("delete from VERSION")
|
||||
skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object("ROOT", "ROOT"))
|
||||
skmt.ExecNonQuery("delete from cat_almacen")
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object (user.Text))
|
||||
skmt.ExecNonQuery2("INSERT INTO VERSION(NOVERSION) VALUES (?)", Array As Object ("2.1"))
|
||||
|
||||
StartActivity(seleccion)
|
||||
Else
|
||||
c=skmt.ExecQuery2("select count(*) as EXISTE1 from usuarioa where usuario = ?", Array As String(user.Text))
|
||||
c.Position=0
|
||||
existe = c.GetString("EXISTE1")
|
||||
|
||||
'existe = 1
|
||||
If existe = 0 Then
|
||||
'skmt.ExecNonQuery("delete from usuarioa")
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_usuario_guna_DUR"
|
||||
cmd.Parameters = Array As Object(user.Text, pass.Text)
|
||||
reqManager.ExecuteQuery(cmd , 0, "usuario")
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_version"
|
||||
reqManager.ExecuteQuery(cmd , 0, "version")
|
||||
|
||||
|
||||
Else
|
||||
StartActivity(seleccion)
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
Sub JobDone(Job As HttpJob)
|
||||
If Job.Success = False Then
|
||||
ToastMessageShow("Error: " & Job.ErrorMessage, True)
|
||||
Else
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "version" Then 'query tag
|
||||
For Each records() As Object In result.Rows
|
||||
skmt.ExecNonQuery("delete from VERSION")
|
||||
Dim CAT_VE_VERSION As String = records(result.Columns.Get("CAT_VE_VERSION"))
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO VERSION(NOVERSION) VALUES (?)", Array As Object (CAT_VE_VERSION))
|
||||
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "agencia" Then 'query tag
|
||||
For Each records() As Object In result.Rows
|
||||
|
||||
Dim ID_ALMACEN As String = records(result.Columns.Get("ID_ALMACEN"))
|
||||
|
||||
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Job.JobName = "DBRequest" Then
|
||||
Dim result As DBResult = reqManager.HandleJob(Job)
|
||||
If result.Tag = "usuario" Then 'query tag
|
||||
|
||||
For Each records() As Object In result.Rows
|
||||
Dim name As String = records(result.Columns.Get("USUARIO"))
|
||||
Dim ID_ALMACEN As String = records(result.Columns.Get("CAT_LO_AGENCIA"))
|
||||
Dim IMEI_BASE As String = records(result.Columns.Get("CAT_LO_IDTELEFONO"))
|
||||
|
||||
|
||||
Next
|
||||
paso1 = 1
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Job.Release
|
||||
|
||||
End If
|
||||
|
||||
If paso1 =1 Then
|
||||
If name = "OKActivo" Then
|
||||
skmt.ExecNonQuery("delete from usuarioa")
|
||||
skmt.ExecNonQuery2("INSERT INTO USUARIOA VALUES (?,?)", Array As Object(user.Text, pass.Text))
|
||||
skmt.ExecNonQuery("delete from cat_almacen")
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_ALMACEN(ID_ALMACEN) VALUES (?)", Array As Object (ID_ALMACEN))
|
||||
|
||||
StartActivity(seleccion)
|
||||
Else If name = "OKExpirado"& IMEI Then
|
||||
Msgbox("Usuario Expirado llamar al administrador","")
|
||||
Else If name = "OKCancelado"& IMEI Then
|
||||
Msgbox("Usuario Cancelado llamar al administrador","")
|
||||
Else
|
||||
Msgbox("Usuario o password No validos","")
|
||||
End If
|
||||
paso1 = 0
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
'StartActivity(Main)
|
||||
ExitApplication
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
Sub dameUsuario
|
||||
c=skmt.ExecQuery("select count(*) as EXISTE1 from usuarioa")
|
||||
c.Position=0
|
||||
existe = c.GetString("EXISTE1")
|
||||
c.Close
|
||||
If existe > 0 Then
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
Else
|
||||
usuario = "SINUSUARIO"
|
||||
End If
|
||||
End Sub
|
||||
69
Durakelo_reparto.b4a.meta
Normal file
@@ -0,0 +1,69 @@
|
||||
ModuleBookmarks0=
|
||||
ModuleBookmarks1=
|
||||
ModuleBookmarks10=
|
||||
ModuleBookmarks11=
|
||||
ModuleBookmarks12=
|
||||
ModuleBookmarks13=
|
||||
ModuleBookmarks14=
|
||||
ModuleBookmarks15=
|
||||
ModuleBookmarks16=
|
||||
ModuleBookmarks17=
|
||||
ModuleBookmarks18=
|
||||
ModuleBookmarks19=
|
||||
ModuleBookmarks2=
|
||||
ModuleBookmarks20=
|
||||
ModuleBookmarks21=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
ModuleBookmarks6=
|
||||
ModuleBookmarks7=
|
||||
ModuleBookmarks8=
|
||||
ModuleBookmarks9=
|
||||
ModuleBreakpoints0=
|
||||
ModuleBreakpoints1=
|
||||
ModuleBreakpoints10=
|
||||
ModuleBreakpoints11=
|
||||
ModuleBreakpoints12=
|
||||
ModuleBreakpoints13=
|
||||
ModuleBreakpoints14=
|
||||
ModuleBreakpoints15=
|
||||
ModuleBreakpoints16=
|
||||
ModuleBreakpoints17=
|
||||
ModuleBreakpoints18=
|
||||
ModuleBreakpoints19=
|
||||
ModuleBreakpoints2=
|
||||
ModuleBreakpoints20=
|
||||
ModuleBreakpoints21=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
ModuleBreakpoints6=
|
||||
ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=7
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=
|
||||
ModuleClosedNodes13=
|
||||
ModuleClosedNodes14=
|
||||
ModuleClosedNodes15=
|
||||
ModuleClosedNodes16=9
|
||||
ModuleClosedNodes17=2,3,4,5,7,8,9,10,13,14,15,16,17,18,19,20,21
|
||||
ModuleClosedNodes18=
|
||||
ModuleClosedNodes19=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes20=
|
||||
ModuleClosedNodes21=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=3,6,8,17,18,19
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=seleccion,Subir_Click,485,0,seleccion,to_number_vb,417,0,seleccion,Activity_Resume,399,0,nopago,Globals,30,0,fila,Activity_Create,149,0,Visual Designer,info_gral.bal,-100,1,fila,Activity_Pause,222,0,fila,Activity_Resume,217,0,fila,GPS_LocationChanged,233,0,Main,Activity_Create,60,0,Main,Process_Globals,21,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=18,21,10,9,12,8,4,14,11,2
|
||||
BIN
Files/1.bal
Normal file
BIN
Files/alert2.png
Normal file
|
After Width: | Height: | Size: 632 B |
BIN
Files/alerta.jpg
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
Files/buscar.bal
Normal file
BIN
Files/detalle_promo.bal
Normal file
BIN
Files/durakelo1.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
Files/fila.bal
Normal file
BIN
Files/fondo_kmt.jpg
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
Files/foto.bal
Normal file
BIN
Files/guardagestion.bal
Normal file
BIN
Files/guna_viejo.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
Files/info_gral.bal
Normal file
BIN
Files/infonavit1.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
Files/itembuttonblue.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
Files/keymon_logo.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
Files/kmt.db
Normal file
BIN
Files/login.bal
Normal file
BIN
Files/logo sanfer.jpg
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
Files/logo_exitus1.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
Files/malo.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
Files/mapa.bal
Normal file
BIN
Files/mapa_rutas.bal
Normal file
BIN
Files/nopago.bal
Normal file
BIN
Files/nuevocliente.bal
Normal file
BIN
Files/pedido.bal
Normal file
BIN
Files/planfia_logo.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
Files/planfia_logo_old.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
Files/planfia_logo_old2.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
Files/seleccion.bal
Normal file
BIN
Files/sync.png
Normal file
|
After Width: | Height: | Size: 763 B |
BIN
Files/tarjeta.bal
Normal file
BIN
Files/telefonos.bal
Normal file
272
Historico.bas
Normal file
@@ -0,0 +1,272 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim skmt As SQL
|
||||
Dim g As GPS
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim Regresar As Button
|
||||
|
||||
|
||||
Dim ListView1 As ListView
|
||||
Dim L_CANT As Label
|
||||
Dim L_TOTAL As Label
|
||||
Dim borra As Button
|
||||
Dim Existe As String
|
||||
Dim result As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
Dim cuantos As String
|
||||
Dim nombre_prod As String
|
||||
Dim cuantos_pedido As String
|
||||
|
||||
|
||||
Private Titulo As Label
|
||||
Private P1 As Panel
|
||||
Private lv2 As ListView
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
Activity.LoadLayout("tarjeta")
|
||||
borra.Visible = False
|
||||
Titulo.Text = "Pedido"
|
||||
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
|
||||
L_CANT.Text =""
|
||||
L_TOTAL.Text=""
|
||||
c=skmt.ExecQuery("select count(*) as EXISTE from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 20
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 20
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c.GetString("HVD_PRONOMBRE"),"Cantidad #"& c.GetString("HVD_CANT")& " SubTotal $"& c.GetString("HVD_COSTO_TOT"))
|
||||
Next
|
||||
End If
|
||||
If Existe <> 0 Then
|
||||
c=skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Regresar_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
nombre_prod = Value
|
||||
result = Msgbox2("Seguro que desa borrar este articulo?","Borrar Articulo", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png"))
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
|
||||
c=skmt.ExecQuery2("select HVD_CANT FROM hist_ventas where HVD_pronombre = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
c.Position=0
|
||||
If c.GetString("HVD_CANT") > 1 Then
|
||||
Regresar.Visible =False
|
||||
borra.Visible=False
|
||||
P1.Visible =True
|
||||
cuantos_pedido = c.GetString("HVD_CANT")
|
||||
lv2.Clear
|
||||
For i=1 To c.GetString("HVD_CANT")
|
||||
lv2.AddSingleLine(i)
|
||||
Next
|
||||
Else
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),Value))
|
||||
c.Close
|
||||
|
||||
|
||||
skmt.ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT,REP_FECHA) select HVD_CLIENTE, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT, HVD_FECHA from hist_ventas where HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
|
||||
|
||||
|
||||
c=skmt.ExecQuery2("select HVD_CANT FROM hist_ventas where HVD_pronombre = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),Value))
|
||||
c.Close
|
||||
|
||||
skmt.ExecNonQuery2("delete FROM HIST_VENTAS WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'quitar esta mamada no es ahi
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Activity_Resume
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Sub lv2_ItemClick (Position As Int, Value As Object)
|
||||
If Value = "Todos" Then
|
||||
cuantos = c.GetString("HVD_CANT")
|
||||
Else
|
||||
cuantos = Value
|
||||
End If
|
||||
If cuantos = cuantos_pedido Then
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),nombre_prod))
|
||||
c.Close
|
||||
|
||||
|
||||
skmt.ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT,REP_FECHA) select HVD_CLIENTE, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT, HVD_FECHA from hist_ventas where HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(nombre_prod))
|
||||
|
||||
|
||||
|
||||
c=skmt.ExecQuery2("select HVD_CANT FROM hist_ventas where HVD_pronombre = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(nombre_prod))
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),nombre_prod))
|
||||
c.Close
|
||||
|
||||
skmt.ExecNonQuery2("delete FROM HIST_VENTAS WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(nombre_prod))
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'quitar esta mamada no es ahi
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Regresar.Visible =True
|
||||
borra.Visible=True
|
||||
P1.Visible =False
|
||||
Activity_Resume
|
||||
|
||||
Else
|
||||
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(cuantos,nombre_prod))
|
||||
c.Close
|
||||
|
||||
'modificar tambien esto
|
||||
'Modificaciones para que solo quite una parte.
|
||||
skmt.ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT, REP_FECHA ) select HVD_CLIENTE, HVD_PRONOMBRE, ?, ? * (HVD_COSTO_TOT/?), HVD_FECHA from hist_ventas where HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As Object(cuantos,cuantos,cuantos_pedido, nombre_prod))
|
||||
|
||||
|
||||
|
||||
skmt.ExecNonQuery2("update hist_Ventas set HVD_CANT = HVD_CANT - ? where HVD_pronombre = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As Object(cuantos, nombre_prod))
|
||||
skmt.ExecNonQuery2("update hist_Ventas set HVD_COSTO_TOT = HVD_CANT * (HVD_COSTO_TOT/?) where HVD_pronombre = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As Object(cuantos_pedido, nombre_prod))
|
||||
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(cuantos,nombre_prod))
|
||||
'crear nueva tabla para que guarde el resto.
|
||||
|
||||
|
||||
' skmt.ExecNonQuery2("delete FROM HIST_VENTAS WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Activity_Resume
|
||||
|
||||
|
||||
Regresar.Visible =True
|
||||
borra.Visible=True
|
||||
P1.Visible =False
|
||||
End If
|
||||
|
||||
End Sub
|
||||
349
MAPA_RUTAS.bas
Normal file
@@ -0,0 +1,349 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=9.3
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: False
|
||||
#End Region
|
||||
|
||||
'Activity module
|
||||
Sub Process_Globals
|
||||
Dim GPS As GPS
|
||||
Dim rp As RuntimePermissions
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim c22 As Cursor
|
||||
Dim c3 As Cursor
|
||||
Dim Cnom As Cursor
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
Private gmap As GoogleMap
|
||||
Private MapFragment1 As MapFragment
|
||||
Dim Latitud As Double = 0
|
||||
Dim Longitud As Double = 0
|
||||
Dim Lat2 As Double = 0
|
||||
Dim Lon2 As Double = 0
|
||||
Dim p1, p2 As Location
|
||||
Dim Distance As Float
|
||||
Dim boton1 As Button
|
||||
Dim HUE_BLUE As Float
|
||||
Dim HUE_RED As Float
|
||||
Dim HUE_GREEN As Float
|
||||
Private B_AZUL As Button
|
||||
Private B_ROJO As Button
|
||||
Private B_VERDE As Button
|
||||
Private B_TODOS As Button
|
||||
Dim Tienda As String
|
||||
Dim LatitudRu As Double
|
||||
Dim LongitudRU As Double
|
||||
Dim LIST_AZUL As List
|
||||
Dim LIST_ROJO As List
|
||||
Dim LIST_VERDE As List
|
||||
Dim MARK_AZUL As Marker
|
||||
Dim MARK_ROJO As Marker
|
||||
Dim MARK_VERDE As Marker
|
||||
Dim MARK_CEDIS As Marker
|
||||
Dim rojo As String
|
||||
Dim azul As String
|
||||
Dim verde As String
|
||||
Dim todos As String
|
||||
Dim NumSerie As Int
|
||||
Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener
|
||||
Dim GoogleMapEXTRA As GoogleMapsExtras
|
||||
Dim CODIGO As String
|
||||
Private SEMANA As String
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
Activity.LoadLayout("MAPA_RUTAS")
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
'GPS
|
||||
If(FirstTime) Then
|
||||
GPS.Initialize("GPS")
|
||||
End If
|
||||
|
||||
If MapFragment1.IsGooglePlayServicesAvailable = False Then
|
||||
ToastMessageShow("Please install Google Play Services.", True)
|
||||
End If
|
||||
|
||||
'Boton velocidad'
|
||||
' boton1.Initialize(0)
|
||||
' boton1.Text = 0 &" "&"km/h"
|
||||
' boton1.TextColor = Colors.Red
|
||||
' boton1.TextSize = 15
|
||||
' Activity.AddView(boton1, 40%x, 5dip, 25%x, 40dip)
|
||||
'Fin Boton velocidad'
|
||||
'MARK_CEDIS.IsInitialized
|
||||
MARK_AZUL.IsInitialized
|
||||
MARK_ROJO.IsInitialized
|
||||
MARK_VERDE.IsInitialized
|
||||
|
||||
LIST_AZUL.Initialize
|
||||
LIST_ROJO.Initialize
|
||||
LIST_VERDE.Initialize
|
||||
|
||||
verde = 0
|
||||
azul = 0
|
||||
rojo = 0
|
||||
todos = 1
|
||||
' c=skmt.ExecQuery2("select count(*) AS CUANTOS from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA"))
|
||||
' c.Position =0
|
||||
' SEMANA = c.GetString("CUANTOS")
|
||||
' c.Close
|
||||
'
|
||||
' If SEMANA > 0 Then
|
||||
' c=skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SEMANA"))
|
||||
' c.Position =0
|
||||
' SEMANA = c.GetString("CAT_VA_VALOR")
|
||||
' c.Close
|
||||
' End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub MapFragment1_Ready
|
||||
gmap = MapFragment1.GetMap
|
||||
gmap.IsInitialized
|
||||
'todos= 1
|
||||
'permisos
|
||||
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
gmap.MyLocationEnabled = Result
|
||||
|
||||
Dim JavaMapsObject As JavaObject
|
||||
JavaMapsObject = gmap.GetUiSettings
|
||||
JavaMapsObject.RunMethod("setMapToolbarEnabled", Array As Object(True))
|
||||
|
||||
|
||||
'''''''----------------------------MARKER AZUL - POR VISITAR
|
||||
|
||||
If azul =1 Or todos = 1 Then
|
||||
c.IsInitialized
|
||||
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS PENDIENTES POR VISITAR
|
||||
|
||||
c=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE IN (select CAT_CL_CODIGO from kmt_info where gestion = 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO') AND HV_LONG IS NOT NULL AND HV_LAT IS NOT NULL AND HV_LONG <> 0 AND HV_LAT <> 0")
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
For i = 0 To c.RowCount -1
|
||||
c.Position = i
|
||||
LatitudRu = c.GetDouble("HV_LAT")
|
||||
LongitudRU = c.GetDouble("HV_LONG")
|
||||
CODIGO=c.GetString("HV_CLIENTE")
|
||||
Cnom=skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = ? ",Array As String(CODIGO))
|
||||
Cnom.Position = 0
|
||||
Tienda= Cnom.GetString("CAT_CL_NOMBRE")
|
||||
MARK_AZUL = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO, gmap.HUE_BLUE)
|
||||
MARK_AZUL.Snippet = Tienda
|
||||
|
||||
Next
|
||||
|
||||
c .Close
|
||||
LIST_AZUL.Add(MARK_AZUL)
|
||||
|
||||
End If
|
||||
|
||||
'''''''----------------------------MARKER VERDE - VENTA
|
||||
If verde =1 Or todos = 1 Then
|
||||
c2.IsInitialized
|
||||
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS
|
||||
c2=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE IN (select CAT_CL_CODIGO from kmt_info where gestion = 2 AND CAT_CL_NOMBRE <>'VENTA ABORDO') AND HV_LONG IS NOT NULL AND HV_LAT IS NOT NULL AND HV_LONG <> 0 AND HV_LAT <> 0")
|
||||
|
||||
|
||||
'c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ")
|
||||
For i = 0 To c2.RowCount -1
|
||||
c2.Position = i
|
||||
LongitudRU = c2.GetDouble("HV_LONG")
|
||||
LatitudRu = c2.GetDouble("HV_LAT")
|
||||
CODIGO=c2.GetString("HV_CLIENTE")
|
||||
Cnom=skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = ? ",Array As String(CODIGO))
|
||||
Cnom.Position = 0
|
||||
Tienda= Cnom.GetString("CAT_CL_NOMBRE")
|
||||
MARK_VERDE = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO,gmap.HUE_GREEN)
|
||||
MARK_VERDE.Snippet = Tienda
|
||||
|
||||
Next
|
||||
|
||||
Else
|
||||
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LA VENTAS--- ESTE VA IGUAL QUE EL ANTERIOR
|
||||
If verde =1 Or todos = 1 Then
|
||||
c2.IsInitialized
|
||||
c2=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE IN (select CAT_CL_CODIGO from kmt_info where gestion = 2 AND CAT_CL_NOMBRE <>'VENTA ABORDO') AND HV_LONG IS NOT NULL AND HV_LAT IS NOT NULL AND HV_LONG <> 0 AND HV_LAT <> 0")
|
||||
|
||||
|
||||
'c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ")
|
||||
For i = 0 To c2.RowCount -1
|
||||
c2.Position = i
|
||||
LongitudRU = c2.GetDouble("HV_LONG")
|
||||
LatitudRu = c2.GetDouble("HV_LAT")
|
||||
CODIGO=c2.GetString("HV_CLIENTE")
|
||||
Cnom=skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = ? ",Array As String(CODIGO))
|
||||
Cnom.Position = 0
|
||||
Tienda= Cnom.GetString("CAT_CL_NOMBRE")
|
||||
MARK_VERDE = gmap.AddMarker2(LatitudRu,LongitudRU,CODIGO,gmap.HUE_GREEN)
|
||||
MARK_VERDE.Snippet = Tienda
|
||||
Next
|
||||
c2 .Close
|
||||
LIST_VERDE.Add(MARK_VERDE)
|
||||
End If
|
||||
End If
|
||||
|
||||
' '''''''----------------------------MARKER ROJO - NO VENTA
|
||||
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LAS NO VENTAS
|
||||
If rojo =1 Or todos = 1 Then
|
||||
c3.IsInitialized
|
||||
|
||||
c3=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE IN (select CAT_CL_CODIGO from kmt_info where gestion = 3 AND CAT_CL_NOMBRE <>'VENTA ABORDO') AND HV_LONG IS NOT NULL AND HV_LAT IS NOT NULL AND HV_LONG <> 0 AND HV_LAT <> 0")
|
||||
|
||||
'c3=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 3 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 AND CAT_CL_NOMBRE <>'VENTA ABORDO' ")
|
||||
For i = 0 To c3.RowCount -1
|
||||
c3.Position = i
|
||||
LongitudRU = c3.GetDouble("HV_LONG")
|
||||
LatitudRu = c3.GetDouble("HV_LAT")
|
||||
CODIGO=c3.GetString("HV_CLIENTE")
|
||||
Cnom=skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = ? ",Array As String(CODIGO))
|
||||
Cnom.Position = 0
|
||||
Tienda= Cnom.GetString("CAT_CL_NOMBRE")
|
||||
MARK_ROJO = gmap.AddMarker2(LatitudRu,LongitudRU,Tienda, gmap.HUE_RED)
|
||||
MARK_ROJO.Snippet = Tienda
|
||||
Next
|
||||
|
||||
Else
|
||||
'''''''''VERIFICAR EN QUE TABLA O EN QUE CAMPO NOS LEE LAS NO VENTAS- ESTE VA IGUAL QUE EL ANTERIOR
|
||||
If rojo =1 Or todos = 1 Then
|
||||
c3.IsInitialized
|
||||
|
||||
c3=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE IN (select CAT_CL_CODIGO from kmt_info where gestion = 3 AND CAT_CL_NOMBRE <>'VENTA ABORDO') AND HV_LONG IS NOT NULL AND HV_LAT IS NOT NULL AND HV_LONG <> 0 AND HV_LAT <> 0")
|
||||
|
||||
For i = 0 To c3.RowCount -1
|
||||
c3.Position = i
|
||||
LongitudRU = c3.GetDouble("HV_LONG")
|
||||
LatitudRu = c3.GetDouble("HV_LAT")
|
||||
CODIGO=c3.GetString("HV_CLIENTE")
|
||||
Cnom=skmt.ExecQuery2("select CAT_CL_CODIGO,CAT_CL_NOMBRE from kmt_info where CAT_CL_CODIGO = ? ",Array As String(CODIGO))
|
||||
Cnom.Position = 0
|
||||
Tienda= Cnom.GetString("CAT_CL_NOMBRE")
|
||||
MARK_ROJO = gmap.AddMarker2(LatitudRu,LongitudRU,Tienda, gmap.HUE_RED)
|
||||
MARK_ROJO.Snippet = Tienda
|
||||
Next
|
||||
LIST_ROJO.Add(MARK_ROJO)
|
||||
c3.Close
|
||||
End If
|
||||
End If
|
||||
''------------------------------
|
||||
|
||||
' MARK_CEDIS = gmap.AddMarker3("19.3961802","-99.0784293","CEDIS", LoadBitmap(File.DirAssets, "marker-azul-0.png"))
|
||||
' If MARK_VERDE.Visible Or MARK_ROJO.Visible Then
|
||||
' MARK_CEDIS.Remove
|
||||
' End If
|
||||
Dim aa As CameraPosition
|
||||
aa.Initialize(LatitudRu,LongitudRU,15)''' RECOMENDABLE CAMBIAR A 10 PARA QUE SE VEAN MAS MARCADORES
|
||||
gmap.AnimateCamera(aa)
|
||||
|
||||
'''''---------------------- ESTO ES PARA LOS CLICK EN LAS VENTANAS DE INFORMACION-----------
|
||||
Dim OnInfoWindowClickListener1 As OnInfoWindowClickListener
|
||||
OnInfoWindowClickListener1.Initialize("OnInfoWindowClickListener1")
|
||||
GoogleMapEXTRA.SetOnInfoWindowClickListener(gmap, OnInfoWindowClickListener1)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub OnInfoWindowClickListener1_click(Marker1 As Marker)
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?) ", Array As Object(Marker1.Title))
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub GPS_LocationChanged (Parametro As Location)
|
||||
MARK_CEDIS.IsInitialized
|
||||
' Dim sp As Int
|
||||
' sp = Ceil(Parametro.Speed * 3.6)
|
||||
' boton1.Text = sp &" "&"km/h"
|
||||
' Latitud = Parametro.Latitude
|
||||
' Longitud = Parametro.Longitude
|
||||
' p2.Initialize2(Latitud,Longitud)
|
||||
' p1.Initialize2(Lat2, Lon2)
|
||||
' Distance = p1.DistanceTo(p2)
|
||||
' If Latitud <> 0 And Longitud <> 0 Then
|
||||
' If Distance > 10 Then
|
||||
' Lat2 = Latitud
|
||||
' Lon2 = Longitud
|
||||
' Dim cp As CameraPosition
|
||||
' cp.Initialize2(Parametro.Latitude, Parametro.Longitude, gmap.CameraPosition.Zoom, Parametro.Bearing, 0)
|
||||
' gmap.AnimateCamera(cp)
|
||||
' End If
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
|
||||
If GPS.GPSEnabled = False Then
|
||||
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
|
||||
StartActivity(GPS.LocationSettingsIntent)
|
||||
Else
|
||||
GPS.Start(0, 0)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
GPS.Stop
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B_TODOS_Click
|
||||
todos =1
|
||||
verde = 0
|
||||
azul = 0
|
||||
rojo = 0
|
||||
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_VERDE_Click
|
||||
verde = 1
|
||||
azul = 0
|
||||
rojo = 0
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_ROJO_Click
|
||||
rojo = 1
|
||||
verde = 0
|
||||
azul = 0
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_AZUL_Click
|
||||
azul = 1
|
||||
verde = 0
|
||||
rojo = 0
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
90
Starter.bas
Normal file
@@ -0,0 +1,90 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Service
|
||||
Version=10.2
|
||||
@EndOfDesignText@
|
||||
#Region Service Attributes
|
||||
#StartAtBoot: False
|
||||
#ExcludeFromLibrary: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Public rp As RuntimePermissions
|
||||
Public FLP As FusedLocationProvider
|
||||
Dim pe As PhoneEvents
|
||||
Dim Timer1 As Timer
|
||||
Dim Interval As Int = 15
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
'This is the program entry point.
|
||||
'This is a good place to load resources that are not specific to a single activity.
|
||||
pe.Initialize("pe") 'Para obtener la bateria
|
||||
Timer1.Initialize("Timer1", Interval * 1000)
|
||||
Timer1.Enabled = True
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
|
||||
End Sub
|
||||
|
||||
Sub Service_TaskRemoved
|
||||
'This event will be raised when the user removes the app from the recent apps list.
|
||||
End Sub
|
||||
|
||||
'Return true to allow the OS default exceptions handler to handle the uncaught exception.
|
||||
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
||||
Return True
|
||||
End Sub
|
||||
|
||||
Sub Service_Destroy
|
||||
|
||||
End Sub
|
||||
|
||||
Sub pe_BatteryChanged (Level As Int, Scale As Int, Plugged As Boolean, Intent As Intent)
|
||||
Main.batt=Level
|
||||
Log(main.batt)
|
||||
End Sub
|
||||
|
||||
Private Sub Timer1_Tick
|
||||
' ToastMessageShow("Timer",False)
|
||||
If Main.logger Then Log("Siguiente actuaizacion " & DateTime.Time(DateTime.Now + Interval * 1000))
|
||||
ENVIA_ULTIMA_GPS
|
||||
End Sub
|
||||
|
||||
Sub ENVIA_ULTIMA_GPS
|
||||
Log("Iniciamos ENVIA_ULTIMA_GPS")
|
||||
Dim cmd As DBCommand
|
||||
Dim reqManager As DBRequestManager
|
||||
DateTime.TimeFormat = "HHmmss"
|
||||
Main.ultimaActualizacionGPS = DateTime.Time(DateTime.Now)
|
||||
|
||||
reqManager.Initialize(Me, Main.server)
|
||||
Main.skmt.Initialize(Main.ruta,"kmt.db", True)
|
||||
cmd.Initialize
|
||||
cmd.Name = "select_fechat"
|
||||
reqManager.ExecuteQuery(cmd , 0, "fechat")
|
||||
|
||||
Dim cmd As DBCommand
|
||||
cmd.Initialize
|
||||
|
||||
' cmd.Name = "UPDATE_DURK_ACTUAL2_GPS"
|
||||
' cmd.Parameters = Array As Object(Main.montoActual,Main.clientestotal, Main.clientesventa,Main.clientesvisitados,Main.lat_gps,Main.lon_gps,Main.batt,0, 0, 0,Main.ALMACEN,Main.rutapreventa)
|
||||
'
|
||||
cmd.Name = "UPDATE_DUR_ACTUALR2_GPS"
|
||||
cmd.Parameters = Array As Object(Main.montoActual,Main.montorechazo,Main.clientestotal ,Main.clientesventa ,Main.lat_gps, Main.lon_gps, Main.batt,Main.clientesvisitados ,Main.Montosalida,Main.ALMACEN,Main.rutapreventa )
|
||||
' ToastMessageShow(Main.montoActual & Main.clientestotal & Main.clientesventa & Main.clientesvisitados & Main.lat_gps & Main.lon_gps & Main.batt & Main.ALMACEN & Main.rutapreventa, True)
|
||||
reqManager.ExecuteCommand(cmd,"inst_visitas")
|
||||
|
||||
Main.skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ? WHERE CAT_VA_DESCRIPCION = ?" , Array As String(DateTime.Time(DateTime.Now),"HoraIngreso"))
|
||||
Log("Data="&Main.montoActual&"|"&Main.clientestotal&"|"&Main.clientesventa&"|"&Main.clientesvisitados&"|"&Main.lat_gps&"|"&Main.lon_gps&"|"&Main.batt&"|"&0&"|"&0&"|"&0&"|"&Main.ALMACEN&"|"&Main.rutapreventa&"|")
|
||||
|
||||
'Reiniciamos el timer para cuando llamamos el Sub desde "seleccion"
|
||||
Timer1.Enabled = False
|
||||
Timer1.Interval = Interval * 1000
|
||||
Timer1.Enabled = True
|
||||
ToastMessageShow("T",False)
|
||||
End Sub
|
||||
223
Tracker.bas
Normal file
@@ -0,0 +1,223 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Service
|
||||
Version=10.2
|
||||
@EndOfDesignText@
|
||||
#Region Service Attributes
|
||||
#StartAtBoot: True
|
||||
#End Region
|
||||
'******************************************************************************
|
||||
'No olvidar agregar esta linea al editor de manifiesto:
|
||||
' SetServiceAttribute(Tracker, android:foregroundServiceType, "location")
|
||||
'
|
||||
'En Starter agregar estas lineas en Process_Globals
|
||||
' Public rp As RuntimePermissions
|
||||
' Public FLP As FusedLocationProvider
|
||||
' Private flpStarted As Boolean
|
||||
'
|
||||
'En Main agregar estas lineas a Activity_Resume
|
||||
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
' Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
' If Result Then
|
||||
' StartService(Tracker)
|
||||
' Log("Start Tracker")
|
||||
' Else
|
||||
' ToastMessageShow("No permission", True)
|
||||
' End If
|
||||
'
|
||||
'Se necesitan las librerias FusedLocationProvider, GPS, Phone y RunTimePermissions
|
||||
'
|
||||
'Y en Main agregar estas dos lineas:
|
||||
'#AdditionalJar: com.android.support:support-v4
|
||||
'#AdditionalJar: com.google.android.gms:play-services-location
|
||||
|
||||
Sub Process_Globals
|
||||
Private nid As Int = 1
|
||||
Private Tracking As Boolean
|
||||
Private lock As PhoneWakeState
|
||||
'Para FusedLocationProvider (2 lineas)
|
||||
Public FLP As FusedLocationProvider
|
||||
Dim actualLR As LocationRequest
|
||||
Private flpStarted As Boolean
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves
|
||||
'Para FusedLocationProvider (2 lineas)
|
||||
FLP.Initialize("flp")
|
||||
FLP.Connect
|
||||
lock.PartialLock
|
||||
StartFLP
|
||||
End Sub
|
||||
|
||||
Sub flp_ConnectionSuccess
|
||||
If Main.logger Then Log("Connected to location provider")
|
||||
'FLP.GetLastKnownLocation
|
||||
End Sub
|
||||
|
||||
Sub flp_ConnectionFailed(ConnectionResult1 As Int)
|
||||
If Main.logger Then Log("Failed to connect to location provider")
|
||||
End Sub
|
||||
|
||||
Sub flp_ConnectionSuspended(ConnectionResult1 As Int)
|
||||
If Main.logger Then Log("FLP conection suspended")
|
||||
StartFLP
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
If Main.logger Then Log("Tracker Service Started")
|
||||
'Para FusedLocationProvider (1 linea)
|
||||
Service.StopAutomaticForeground
|
||||
Service.StartForeground(nid, CreateNotification("..."))
|
||||
Track
|
||||
StartServiceAt(Me, DateTime.Now + 5 * DateTime.TicksPerMinute, True)
|
||||
End Sub
|
||||
|
||||
Public Sub Track
|
||||
If Main.logger Then Log("Inicia Track - Tracking : "&Tracking)
|
||||
If Tracking Then
|
||||
' Log(actualLR.GetSmallestDisplacement)
|
||||
Return 'Si ya estamos "rastreando" no hacemos nada (return)
|
||||
End If
|
||||
If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) = False Then
|
||||
If Main.logger Then Log("No permission")
|
||||
Return
|
||||
End If
|
||||
StartFLP 'Iniciamos FusedLocationProvider
|
||||
Tracking = True
|
||||
End Sub
|
||||
|
||||
Public Sub StartFLP
|
||||
If Main.logger Then Log("StartFLP - flpStarted="&flpStarted)
|
||||
Do While FLP.IsConnected = False
|
||||
Sleep(500)
|
||||
If Main.logger Then Log("sleeping")
|
||||
Loop
|
||||
' If flpStarted = False Then
|
||||
If Main.logger Then Log("RequestLocationUpdates")
|
||||
FLP.RequestLocationUpdates(CreateLocationRequest) 'Buscamos ubicacion
|
||||
If Main.logger Then Log("Buscamos ubicacion")
|
||||
If Main.logger Then Log(actualLR.GetSmallestDisplacement)
|
||||
flpStarted = True
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Public Sub StartFLP2Reqs
|
||||
If Main.logger Then Log("StartFLP - flpStarted="&flpStarted)
|
||||
Do While FLP.IsConnected = False
|
||||
Sleep(500)
|
||||
If Main.logger Then Log("sleeping")
|
||||
Loop
|
||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
||||
FLP.RequestLocationUpdates(CreateLocationRequest2times) 'Buscamos ubicacion 2 peticiones
|
||||
If Main.logger Then Log("Buscamos ubicacion 2 peticiones")
|
||||
If Main.logger Then Log(actualLR.GetSmallestDisplacement)
|
||||
End Sub
|
||||
|
||||
Private Sub CreateLocationRequest As LocationRequest
|
||||
If Main.logger Then Log("CreateLocationRequest")
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(10000) 'Intervalo deseado para actualizaciones de ubicacion
|
||||
lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
||||
lr.SetSmallestDisplacement(75) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
End Sub
|
||||
|
||||
Private Sub CreateLocationRequest2times As LocationRequest
|
||||
If Main.logger Then Log("Iniciamos CreateLocationRequest2times")
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(2000) 'Intervalo deseado para actualizaciones de ubicacion
|
||||
lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion
|
||||
lr.setNumUpdates(2) 'Solicitamos solo 2 actualizaciones con estos parametros
|
||||
lr.SetSmallestDisplacement(10) 'Solo registra cambio de ubicacion si es mayor a XX mts
|
||||
lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY)
|
||||
actualLR=lr
|
||||
Return lr
|
||||
End Sub
|
||||
|
||||
Sub dameUltimaUbicacionConocida
|
||||
If FLP.GetLastKnownLocation.IsInitialized Then 'Mandamos ultima ubicacion guardada
|
||||
If Main.logger Then Log("Mandamos GetLastKnownLocation : "&formatoFecha(FLP.GetLastKnownLocation.Time))
|
||||
Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&formatoFecha(FLP.GetLastKnownLocation.Time)
|
||||
' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub StopFLP
|
||||
'Log("StopFLP")
|
||||
If flpStarted Then
|
||||
FLP.RemoveLocationUpdates 'Eliminamos todas las solicitudes de ubicacion
|
||||
flpStarted = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub flp_LocationChanged (Location1 As Location)
|
||||
If Main.logger Then Log("SmallestDisplacement="&actualLR.GetSmallestDisplacement)
|
||||
CallSub2(Starter, "GPS_LocationChanged", Location1)
|
||||
CallSub2(gestion, "GPS_LocationChanged", Location1)
|
||||
CallSub2(MAPA_RUTAS, "GPS_LocationChanged", Location1)
|
||||
CallSub2(fila, "GPS_LocationChanged", Location1)
|
||||
|
||||
Main.lat_gps = Location1.ConvertToSeconds(Location1.Latitude)
|
||||
Main.lon_gps = Location1.ConvertToSeconds(Location1.Longitude)
|
||||
'/////// para la ultima ubicacion FL
|
||||
Dim sDate,sTime As String
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
Try
|
||||
Main.skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
||||
Main.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, Main.lat_gps, Main.lon_gps))
|
||||
Catch
|
||||
If Main.logger Then Log("Error al borrar o insertar nuevas coordendas en HIST_GPS")
|
||||
End Try
|
||||
'///////
|
||||
Dim coords As String = Location1.Latitude&","&Location1.Longitude&","&formatoFecha(Location1.Time)
|
||||
If Main.logger Then Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&Main.usuario&"|")
|
||||
If Main.logger Then Log("Mandamos Ubicacion")
|
||||
'' If Main.logger Then Log(FirebaseMessaging.locRequest)
|
||||
' Solo mandamos la ubicacion si la precision es dentro de XX mts
|
||||
' If Location1.Accuracy < 300 Then CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
||||
Dim origFormat As String = DateTime.TimeFormat 'Guardamos formato de fecha
|
||||
DateTime.TimeFormat = "HHmmss" ' Modificamos formato de fecha
|
||||
Dim minsDif As Int = DateTime.Time(DateTime.Now) - Main.ultimaActualizacionGPS
|
||||
If Main.logger Then Log("UltimaAct="&Main.ultimaActualizacionGPS&" MinsDif="&minsDif)
|
||||
If Location1.Accuracy < 100 And minsDif > 240 Then 'Si precision de 100 y 4 min transcurridos manda a web
|
||||
If Main.logger Then Log("actualizamos Ubicacion")
|
||||
CallSubDelayed(Starter, "ENVIA_ULTIMA_GPS")
|
||||
End If
|
||||
DateTime.TimeFormat = origFormat 'Regresamos formato de fecha original
|
||||
' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
||||
End Sub
|
||||
|
||||
Sub CreateNotification (Body As String) As Notification
|
||||
Dim notification As Notification
|
||||
notification.Initialize2(notification.IMPORTANCE_LOW)
|
||||
notification.Icon = "icon"
|
||||
notification.SetInfo("Durakelo", Body, Main)
|
||||
If Main.logger Then Log("Creamos notificacion")
|
||||
Return notification
|
||||
End Sub
|
||||
|
||||
Sub Service_Destroy
|
||||
If Tracking Then
|
||||
StopFLP
|
||||
End If
|
||||
Tracking = False
|
||||
lock.ReleasePartialLock
|
||||
End Sub
|
||||
|
||||
Sub formatoFecha(fecha As String) As String 'Convierte una fecha al formato yyMMddHHmmss
|
||||
' Log(fecha)
|
||||
Dim OrigFormat As String = DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat="yyMMddHHmmss"
|
||||
Dim lastUpdate As String=DateTime.Date(fecha)
|
||||
DateTime.DateFormat=OrigFormat 'return to orig date format
|
||||
' Log(lastUpdate)
|
||||
Return lastUpdate
|
||||
End Sub
|
||||
211
colonia.bas
Normal file
@@ -0,0 +1,211 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
|
||||
Dim ruta As String
|
||||
Dim q_buscar As String
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim ListView1 As ListView
|
||||
Dim entro As String
|
||||
Dim gest As Button
|
||||
Dim lfila As Label
|
||||
Dim busca As EditText
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
Activity.LoadLayout("fila")
|
||||
'Dim ruta As String
|
||||
entro ="2"
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
busca.Text = ""
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
entro ="2"
|
||||
|
||||
' esto es para rutas se quito por colonia
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA, count(*) as cuantos from kmt_info where gestion = 0 group by CAT_CL_RUTA order by CAT_CL_RUTA asc")
|
||||
'SE COMENTA EL SIGUIENTE CODIGO PARA QUE TODAS LAS TIENDAS APARESCAN.
|
||||
'c=skmt.ExecQuery("select CAT_CL_COLONIA, count(*) as cuantos from kmt_info where gestion = 0 group by CAT_CL_COLONIA order by CAT_CL_COLONIA asc")
|
||||
|
||||
ListView1.Clear
|
||||
lfila.Text = "RUTA PREVENTA"
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 22
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 22
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c.GetString("CAT_CL_RUTA"),c.GetString("cuantos"))
|
||||
Next
|
||||
End If
|
||||
' ESTE FUE EL FIN DEL CODIGO COMENTADO
|
||||
'c2=skmt.ExecQuery("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where gestion = 0 order by CAT_CL_NOMBRE ")
|
||||
' ListView1.Clear
|
||||
'lfila.text = "Nombre y Calle"
|
||||
|
||||
'If c2.RowCount>0 Then
|
||||
' For i=0 To c2.RowCount -1
|
||||
' c2.Position=i
|
||||
' Dim label1 As Label
|
||||
' label1 = ListView1.TwoLinesLayout.Label
|
||||
' label1.TextSize = 9
|
||||
' label1.TextColor = Colors.White
|
||||
' Dim label2 As Label
|
||||
' label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
' label2.TextSize = 17
|
||||
' label2.TextColor = Colors.White
|
||||
' ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
|
||||
' Next
|
||||
' End If
|
||||
' entro = "3"
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
'Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
|
||||
'que_colonia = Value
|
||||
'StartActivity(fila)
|
||||
|
||||
'If entro = "1" Then
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
'se comenta para lo anterior c2=skmt.ExecQuery2("select CAT_CL_COLONIA, count(*) as cuantos from kmt_info where CAT_CL_RUTA = ? and gestion = 0 group by CAT_CL_COLONIA order by CAT_CL_COLONIA asc", Array As String(Value))
|
||||
' c2=skmt.ExecQuery2("select CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_COLONIA = ? and gestion = 0", Array As String(Value))
|
||||
|
||||
ListView1.Clear
|
||||
' lfila.text = "COLONIA"
|
||||
|
||||
' If c2.RowCount>0 Then
|
||||
' For i=0 To c2.RowCount -1
|
||||
' c2.Position=i
|
||||
' ListView1.AddTwoLines(c2.GetString("CAT_CL_COLONIA"),c2.GetString("cuantos"))
|
||||
' Next
|
||||
' End If
|
||||
' entro = "2"
|
||||
If entro = "2" Then
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c2=skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_RUTA = ? and gestion = 0 order by CAT_CL_NOMBRE ", Array As String(Value))
|
||||
ListView1.Clear
|
||||
lfila.text = "Nombre y Calle"
|
||||
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 22
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 22
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
|
||||
Next
|
||||
End If
|
||||
entro = "3"
|
||||
Else If entro = "3" Then
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
|
||||
StartActivity(fila)
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' If entro = "3" Then
|
||||
'entro = "2"
|
||||
'Activity_Resume
|
||||
'Return True
|
||||
'Else If entro = "2" Then
|
||||
'entro = "1"
|
||||
'Activity_Resume
|
||||
'Return True
|
||||
'Else If entro = "1" Then
|
||||
|
||||
' I want to capture the key here so I return True
|
||||
|
||||
StartActivity(seleccion)
|
||||
Return False
|
||||
'End If
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
|
||||
End Sub
|
||||
|
||||
Sub BUSCA_TextChanged (Old As String, New As String)
|
||||
q_buscar = "%" & busca.Text & "%"
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
c2=skmt.ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_NOMBRE like ? and gestion = 0 order by CAT_CL_CODIGO ", Array As String(q_buscar))
|
||||
ListView1.Clear
|
||||
lfila.text = "Nombre y Calle"
|
||||
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 22
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 22
|
||||
label2.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_CL_CODIGO"), c2.GetString("CAT_CL_NOMBRE") &" CALLE: "& c2.GetString("CAT_CL_CALLE"))
|
||||
Next
|
||||
End If
|
||||
entro = "3"
|
||||
|
||||
c2.Close
|
||||
End Sub
|
||||
213
colonia2.bas
Normal file
@@ -0,0 +1,213 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
|
||||
Dim ruta As String
|
||||
Dim q_buscar As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim c2 As Cursor
|
||||
Dim ListView1 As ListView
|
||||
Dim entro As String
|
||||
Dim gest As Button
|
||||
Dim lfila As Label
|
||||
Dim marca As String
|
||||
Dim tipo As String
|
||||
Dim subtipo As String
|
||||
Private BUSCA As EditText
|
||||
Dim ya_entro As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
Activity.LoadLayout("fila")
|
||||
'Dim ruta As String
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
'If ya_entro <> "1" Then
|
||||
|
||||
BUSCA.Text =""
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
entro ="1"
|
||||
ya_entro ="1"
|
||||
c=skmt.ExecQuery("select CAT_GP_CLASIF, count(*) as cuantos from cat_gunaprod where CAT_GP_ALMACEN > 0 group by CAT_GP_CLASIF order by CAT_GP_CLASIF asc")
|
||||
ListView1.Clear
|
||||
lfila.Text = "MARCA"
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.White
|
||||
Dim label13 As Label
|
||||
label13 = ListView1.TwoLinesAndBitmap.Label
|
||||
label13.TextSize = 10
|
||||
label13.TextColor = Colors.White
|
||||
Dim label14 As Label
|
||||
label14 = ListView1.TwoLinesAndBitmap.SecondLabel
|
||||
label14.TextSize = 10
|
||||
label14.TextColor = Colors.White
|
||||
ListView1.AddTwoLines(c.GetString("CAT_GP_CLASIF"),c.GetString("cuantos"))
|
||||
Next
|
||||
End If
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub ListView1_ItemClick (Position As Int, Value As Object)
|
||||
'Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
'que_colonia = Value
|
||||
'StartActivity(fila)
|
||||
If Value = "PROMOS" Then
|
||||
entro = "3"
|
||||
marca = "PROMOS"
|
||||
tipo = "PROMOS"
|
||||
End If
|
||||
If entro = "1" Then
|
||||
marca = Value
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c2=skmt.ExecQuery2("select COUNT(*) AS CUANTOS, CAT_GP_TIPO from cat_gunaprod where CAT_GP_ALMACEN > 0 and CAT_GP_CLASIF = ? GROUP BY CAT_GP_TIPO ORDER BY CAT_GP_TIPO ASC", Array As String(Value))
|
||||
ListView1.Clear
|
||||
lfila.text = "TIPO"
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_GP_TIPO"),c2.GetString("CUANTOS"))
|
||||
Next
|
||||
End If
|
||||
entro = "2"
|
||||
Else If entro = "2" Then
|
||||
tipo = Value
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c2=skmt.ExecQuery2("select COUNT(*) AS CUANTOS, CAT_GP_SUBTIPO from cat_gunaprod where CAT_GP_ALMACEN > 0 and CAT_GP_CLASIF = ? and CAT_GP_TIPO = ? GROUP BY CAT_GP_SUBTIPO ORDER BY CAT_GP_SUBTIPO ASC ", Array As String(marca, Value))
|
||||
ListView1.Clear
|
||||
lfila.text = "SUB-TIPO"
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
ListView1.AddTwoLines(c2.GetString("CAT_GP_SUBTIPO"),c2.GetString("CUANTOS"))
|
||||
Next
|
||||
End If
|
||||
entro = "3"
|
||||
|
||||
Else If entro = "3" Then
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c2=skmt.ExecQuery2("select CAT_GP_NOMBRE, CAT_GP_PRECIO, CAT_GP_ALMACEN, CAT_GP_IMG from cat_gunaprod where CAT_GP_ALMACEN > 0 and CAT_GP_CLASIF = ? AND CAT_GP_TIPO = ? AND CAT_GP_SUBTIPO = ? ", Array As String(marca, tipo, Value))
|
||||
ListView1.Clear
|
||||
lfila.text = "PRODUCTO"
|
||||
Dim ins As InputStream
|
||||
Dim bmp As Bitmap
|
||||
Dim jpeg() As Byte
|
||||
If c2.RowCount>0 Then
|
||||
For i=0 To c2.RowCount -1
|
||||
c2.Position=i
|
||||
jpeg = c2.GetBlob("CAT_GP_IMG")
|
||||
ins.InitializeFromBytesArray(jpeg, 0, jpeg.Length)
|
||||
bmp.Initialize2(ins)
|
||||
|
||||
ListView1.AddTwoLinesAndBitmap(c2.GetString("CAT_GP_NOMBRE"),"# " & c2.GetString("CAT_GP_ALMACEN") & " $ " & c2.GetString("CAT_GP_PRECIO"),bmp)
|
||||
Next
|
||||
End If
|
||||
entro = "4"
|
||||
Else If entro = "4" Then
|
||||
|
||||
skmt.ExecNonQuery("delete from PROID")
|
||||
skmt.ExecNonQuery2("INSERT INTO PROID VALUES (?)", Array As Object(Value))
|
||||
StartActivity(pedidos)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
ya_entro ="0"
|
||||
|
||||
If entro = "4" Then
|
||||
entro = "3"
|
||||
Activity_Resume
|
||||
Return True
|
||||
Else If entro = "3" Then
|
||||
entro = "2"
|
||||
Activity_Resume
|
||||
Return True
|
||||
Else If entro = "2" Then
|
||||
entro = "1"
|
||||
Activity_Resume
|
||||
Return True
|
||||
Else If entro = "1" Then
|
||||
|
||||
' I want to capture the key here so I return True
|
||||
|
||||
StartActivity(fila)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
|
||||
End Sub
|
||||
|
||||
Sub BUSCA_TextChanged (Old As String, New As String)
|
||||
q_buscar = "%" & BUSCA.Text & "%"
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery2("select CAT_GP_NOMBRE from cat_gunaprod where CAT_GP_ALMACEN > 0 and CAT_GP_NOMBRE like ? order by CAT_GP_NOMBRE asc", Array As String(q_buscar))
|
||||
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.SingleLineLayout.Label
|
||||
label1.TextSize = 10
|
||||
ListView1.AddSingleLine(c.GetString("CAT_GP_NOMBRE"))
|
||||
Next
|
||||
End If
|
||||
c.Close
|
||||
entro= "4"
|
||||
End Sub
|
||||
140
detalle_promo.bas
Normal file
@@ -0,0 +1,140 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim skmt As SQL
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim Regresar As Button
|
||||
Dim b As Cursor
|
||||
Dim regalo As String
|
||||
|
||||
|
||||
Dim ListView1 As ListView
|
||||
Dim L_CANT As Label
|
||||
Dim L_TOTAL As Label
|
||||
Dim borra As Button
|
||||
Dim Existe As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
Activity.LoadLayout("detalle_promo")
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
c=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
b=skmt.ExecQuery2("select CAT_GP_NOMBRE from cat_gunaprod where CAT_GP_ID = ?", Array As String(C.GetString("CAT_DP_IDPROD")))
|
||||
B.Position =0
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.White
|
||||
If c.GetString("CAT_DP_PRECIO") = 0 Then
|
||||
regalo = "SI"
|
||||
Else
|
||||
regalo = "NO"
|
||||
End If
|
||||
ListView1.AddTwoLines(B.GetString("CAT_GP_NOMBRE"),"Cantidad # "& c.GetString("CAT_DP_PZAS")& " REGALO "& regalo)
|
||||
b.Close
|
||||
Next
|
||||
c.Close
|
||||
End If
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
c=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
b=skmt.ExecQuery2("select CAT_GP_NOMBRE from cat_gunaprod where CAT_GP_ID = ?", Array As String(C.GetString("CAT_DP_IDPROD")))
|
||||
B.Position =0
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.White
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.White
|
||||
If c.GetString("CAT_DP_PRECIO") = 0 Then
|
||||
regalo = "SI"
|
||||
Else
|
||||
regalo = "NO"
|
||||
End If
|
||||
ListView1.AddTwoLines(B.GetString("CAT_GP_NOMBRE"),"Cantidad # "& c.GetString("CAT_DP_PZAS")& " REGALO "& regalo)
|
||||
b.Close
|
||||
Next
|
||||
c.Close
|
||||
End If
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Regresar_Click
|
||||
StartActivity(pedidos)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(pedidos)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
452
fila.bas
Normal file
@@ -0,0 +1,452 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim g As GPS
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
Dim cuenta As String
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Dim cmp20 As Serial
|
||||
Dim printer As TextWriter
|
||||
Dim PairedDevices As Map
|
||||
Dim L As List
|
||||
Dim TAMANO As Int
|
||||
Dim ESPACIO As Int
|
||||
Dim BLANCO As String
|
||||
Dim LONGITUD As String
|
||||
Dim LATITUD As String
|
||||
Dim NOMBRE As String
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
Dim c As Cursor
|
||||
Dim s As Cursor
|
||||
Dim ListView1 As ListView
|
||||
Dim la_cuenta As Label
|
||||
Dim La_nombre As Label
|
||||
Dim la_Calle As Label
|
||||
Dim la_numero As Label
|
||||
Dim la_nint As Label
|
||||
Dim la_edo As Label
|
||||
Dim la_pob As Label
|
||||
Dim la_col As Label
|
||||
Dim la_cp As Label
|
||||
Dim la_zona As Label
|
||||
Dim gest As Button
|
||||
Dim la_saldotot As Label
|
||||
Dim la_saldooper As Label
|
||||
|
||||
Dim Tels As Button
|
||||
Dim Label10 As Label
|
||||
Dim Label11 As Label
|
||||
|
||||
Dim Tar As Button
|
||||
Private L_QR As Label
|
||||
Private BT_QR As Button
|
||||
|
||||
Dim la_comm As Label
|
||||
Dim la_actdte As Label
|
||||
Dim la_usuario As Label
|
||||
Dim la_resultado As Label
|
||||
Dim l_entre1 As Label
|
||||
Dim l_entre2 As Label
|
||||
Dim l_atiende As Label
|
||||
Dim l_atiende2 As Label
|
||||
Dim DATOS As Button
|
||||
Dim Guardar As Button
|
||||
Dim NUEVO As Button
|
||||
Dim lat_gps, lon_gps As String
|
||||
|
||||
Private l_total As Label
|
||||
Private HIST As Button
|
||||
Dim PASA_IMP As String
|
||||
Private B_IMP As Button
|
||||
Dim total_cliente As String
|
||||
Dim CREDITO As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
Activity.LoadLayout("info_gral")
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
|
||||
End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
s=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
s.Position=0
|
||||
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
|
||||
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
|
||||
la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_cp.Text = c.GetString("CAT_CL_CP")
|
||||
l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
la_saldotot.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
la_saldooper.Text = c.GetString("CAT_CL_EMAIL")
|
||||
l_total.Text = s.GetString("TOTAL_CLIE")
|
||||
' la_producto.Text = c.GetString("CDPROD")
|
||||
'la_numero.Text = c.GetString("CDNUMEXT")
|
||||
'la_nint.Text = c.GetString("CDNUMINT")
|
||||
'la_pob.Text = c.GetString("CFSDOGLOBAL")
|
||||
|
||||
'la_saldooper.Text = c.GetString("CAT_CL_FALTA")
|
||||
'Label10.Text = "FECHA DE ALTA"
|
||||
'Label11.Text = "# ENCUESTAS"
|
||||
|
||||
'c=skmt.ExecQuery("select MGCTA, MGACTT, MGGESTT, MGDTEACTT, COMM from hist_gest where MGCTA In (Select cuenta from cuentaa)")
|
||||
'c.Position=0
|
||||
'la_comm.Text = c.GetString("COMM")
|
||||
'la_actdte.Text = C.GetString("MGDTEACTT")
|
||||
'la_usuario.Text = c.GetString("MGGESTT")
|
||||
'la_resultado.Text = c.GetString("MGACTT")
|
||||
|
||||
|
||||
'la_padre.Text = c.GetString("PR_CF_FECHA_DISP")
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
' If FirstTime Then
|
||||
' btAdmin.Initialize("BlueTeeth")
|
||||
' cmp20.Initialize("Printer")
|
||||
' End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT, CAT_CL_BCREDITO from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
s=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
s.Position=0
|
||||
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
|
||||
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
|
||||
la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_cp.Text = c.GetString("CAT_CL_CP")
|
||||
l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
la_saldotot.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
la_saldooper.Text = c.GetString("CAT_CL_EMAIL")
|
||||
l_total.Text = s.GetString("TOTAL_CLIE")
|
||||
CREDITO = C.GetString("CAT_CL_BCREDITO")
|
||||
|
||||
NOMBRE = c.GetString("CAT_CL_NOMBRE")
|
||||
c.Close
|
||||
' c=skmt.ExecQuery("select HV_CLIENTE, HV_LONG, HV_LAT from PUNTEO_GPS where HV_CLIENTE In (Select cuenta from cuentaa)")
|
||||
' c.Position=0
|
||||
' LONGITUD = c.GetString("HV_LONG")
|
||||
' LATITUD = c.GetString("HV_LAT")
|
||||
' Msgbox(LONGITUD & " " & LATITUD,"GPS")
|
||||
If CREDITO = "1" Then
|
||||
Msgbox("AVISO","SE TIENE QUE IMPRIMIR PAGARÉ")
|
||||
End If
|
||||
' la_producto.Text = c.GetString("CDPROD")
|
||||
'la_numero.Text = c.GetString("CDNUMEXT")
|
||||
'la_nint.Text = c.GetString("CDNUMINT")
|
||||
'la_pob.Text = c.GetString("CFSDOGLOBAL")
|
||||
|
||||
'la_saldooper.Text = c.GetString("CAT_CL_FALTA")
|
||||
'Label10.Text = "FECHA DE ALTA"
|
||||
'Label11.Text = "# ENCUESTAS"
|
||||
|
||||
|
||||
'c=skmt.ExecQuery("select MGCTA, MGACTT, MGGESTT, MGDTEACTT, COMM from hist_gest where MGCTA In (Select cuenta from cuentaa)")
|
||||
'c.Position=0
|
||||
'la_comm.Text = c.GetString("COMM")
|
||||
'la_actdte.Text = C.GetString("MGDTEACTT")
|
||||
'la_usuario.Text = c.GetString("MGGESTT")
|
||||
'la_resultado.Text = c.GetString("MGACTT")
|
||||
' StartPrinter
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.Latitude
|
||||
lon_gps=Location1.Longitude
|
||||
Dim sDate,sTime As String
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
skmt.ExecNonQuery("DELETE FROM HIST_GPS")
|
||||
skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps,lon_gps))
|
||||
End Sub
|
||||
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub gest_Click
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("select CUENTA from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select usuario from usuarioa")
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
c.Close
|
||||
skmt.ExecNonQuery("DELETE FROM NOVENTA WHERE NV_CLIENTE IN (select cuenta from cuentaa)")
|
||||
skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, usuario, "ENTREGA","ENTREGA COMPLETA",lat_gps,lon_gps))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa) ")
|
||||
skmt.ExecNonQuery("update HIST_VENTAS SET HVD_ESTATUS = 1 WHERE HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
||||
StartActivity(seleccion)
|
||||
End Sub
|
||||
|
||||
Sub Tels_Click
|
||||
' skmt.ExecNonQuery("delete from PEDIDO")
|
||||
StartActivity(nopago)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(colonia)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
Sub Tar_Click
|
||||
StartActivity(colonia2)
|
||||
End Sub
|
||||
Sub DATOS_Click
|
||||
StartActivity(telefonos)
|
||||
End Sub
|
||||
Sub Guardar_Click
|
||||
StartActivity(seleccion)
|
||||
End Sub
|
||||
Sub NUEVO_Click
|
||||
StartActivity(mapas)
|
||||
End Sub
|
||||
Sub HIST_Click
|
||||
StartActivity(Historico)
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B_IMP_Click
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
CREDITO ="1"
|
||||
If CREDITO = "1" Then
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
printer.Initialize(cmp20.OutputStream)
|
||||
printer.WriteLine("DURAKELO S.A. de C.V.")
|
||||
printer.WriteLine("RFC: DUR-011025-T12")
|
||||
printer.WriteLine(sDate)
|
||||
printer.WriteLine(sTime)
|
||||
printer.WriteLine("Tienda: " & La_nombre.Text)
|
||||
s=skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")
|
||||
s.Position=0
|
||||
printer.WriteLine("Debo (emos) y pagare (mos) incondicionamelte a la orden de DURAKELO SA DE CV a la cantidad de $" & s.GetString("PC_MONTO") & " PESOS _______________________________________________________________________________________________________________ ")
|
||||
printer.WriteLine("en esta ciudad o en cualquier otra que se requiera de pago, valor recibido a mi entera satisfaccion y que me obligo a cumplir el dia______________________.")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine("Si este pagare no fuera cubiertoa su vencimiento Me (nos) obligo (amos) a pagar intereses moratorios a razon de 3 % mensual")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine("------------------------------")
|
||||
printer.WriteLine(" NOMBRE Y FIRMA ")
|
||||
printer.WriteLine("------------------------------")
|
||||
printer.WriteLine(" ")
|
||||
printer.Flush
|
||||
|
||||
End If
|
||||
|
||||
printer.Initialize(cmp20.OutputStream)
|
||||
printer.WriteLine("DURAKELO S.A. de C.V.")
|
||||
printer.WriteLine("RFC: DUR-011025-T12")
|
||||
printer.WriteLine("Tel.: 618-826-0104")
|
||||
printer.WriteLine(sDate)
|
||||
printer.WriteLine(sTime)
|
||||
printer.WriteLine("Vendedor:" & usuario)
|
||||
printer.WriteLine("Tienda: " & La_nombre.Text)
|
||||
s=skmt.ExecQuery("select SUM(HVD_CANT) AS PC_NOART, SUM(HVD_COSTO_TOT) AS PC_MONTO from HIST_VENTAS where HVD_CLIENTE in (Select CUENTA from cuentaa)")
|
||||
s.Position=0
|
||||
printer.WriteLine("Total : $" & s.GetString("PC_MONTO"))
|
||||
s.Close
|
||||
printer.WriteLine("-----------ENTREGA------------")
|
||||
S=skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,length(HVD_cant) as L_CANT,HVD_COSTO_TOT,length(HVD_COSTO_TOT) as L_COSTO_TOT from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) ")
|
||||
|
||||
's=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU, PE_COSTO_TOT, length(PE_COSTO_TOT) as L_COSTO_TOT, PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)", Array As String("VENTA"))
|
||||
If S.RowCount>0 Then
|
||||
For i=0 To S.RowCount -1
|
||||
S.Position=i
|
||||
'If s.GetString("PE_CEDIS") = s.GetString("PE_PROID") Then
|
||||
' printer.WriteLine(s.GetString("PE_PRONOMBRE"))
|
||||
|
||||
'Else
|
||||
|
||||
printer.WriteLine(s.GetString("HVD_CANT") & " " & s.GetString("HVD_PRONOMBRE"))
|
||||
TAMANO = s.GetLong("L_CANT") + TAMANO
|
||||
'TAMANO = s.GetLong("L_COSTOU") + TAMANO
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO
|
||||
|
||||
ESPACIO = ESPACIO - TAMANO
|
||||
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
printer.WriteLine("$" & s.GETSTRING("HVD_COSTO_TOT") )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
'End If
|
||||
Next
|
||||
End If
|
||||
s.Close
|
||||
|
||||
printer.WriteLine("------------------------------")
|
||||
printer.WriteLine("---NO ES UN COMPROBANTE ------")
|
||||
printer.WriteLine("---------FISCAL---------------")
|
||||
printer.WriteLine("---COMPROBANTE DE ENTREGA-----")
|
||||
printer.WriteLine("------------------------------")
|
||||
|
||||
printer.Flush
|
||||
' printer.Close
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Printer_Connected (Success As Boolean)
|
||||
If Success Then
|
||||
|
||||
B_IMP.Enabled = True
|
||||
PASA_IMP = "1"
|
||||
Else
|
||||
B_IMP.Enabled = False
|
||||
If Msgbox2("", "Printer Error","Reprint","Cancel","",Null) = DialogResponse.POSITIVE Then
|
||||
StartPrinter
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub StartPrinter
|
||||
Dim PairedDevices As Map
|
||||
Dim L As List
|
||||
Dim resimp As Int
|
||||
|
||||
ToastMessageShow("Printing.....",True)
|
||||
|
||||
PairedDevices.Initialize
|
||||
|
||||
Try
|
||||
PairedDevices = cmp20.GetPairedDevices
|
||||
Catch
|
||||
Msgbox("Getting Paired Devices","Printer Error")
|
||||
printer.Close
|
||||
cmp20.Disconnect
|
||||
End Try
|
||||
|
||||
If PairedDevices.Size = 0 Then
|
||||
Msgbox("Error Connecting to Printer - Printer Not Found","")
|
||||
Return
|
||||
End If
|
||||
|
||||
If PairedDevices.Size = 1 Then
|
||||
Try
|
||||
'FLEOS
|
||||
cmp20.ConnectInsecure(btAdmin,PairedDevices.Get(PairedDevices.GetKeyAt(0)),1)
|
||||
'cmp20.Connect(PairedDevices.Get(PairedDevices.GetKeyAt(0)))
|
||||
|
||||
Catch
|
||||
Msgbox("Connecting","Printer Error")
|
||||
printer.Close
|
||||
cmp20.Disconnect
|
||||
End Try
|
||||
Else
|
||||
L.Initialize
|
||||
|
||||
For i = 0 To PairedDevices.Size - 1
|
||||
L.Add(PairedDevices.GetKeyAt(i))
|
||||
Next
|
||||
|
||||
resimp = InputList(L, "Choose device", -1)
|
||||
|
||||
If resimp <> DialogResponse.CANCEL Then
|
||||
cmp20.Connect(PairedDevices.Get(L.Get(resimp)))
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
138
fila2.bas
Normal file
@@ -0,0 +1,138 @@
|
||||
Type=Activity
|
||||
Version=3
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim g As GPS
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim ListView1 As ListView
|
||||
Dim la_cuenta As Label
|
||||
Dim La_nombre As Label
|
||||
Dim la_Calle As Label
|
||||
Dim la_numero As Label
|
||||
Dim la_nint As Label
|
||||
Dim la_edo As Label
|
||||
Dim la_pob As Label
|
||||
Dim la_col As Label
|
||||
Dim la_cp As Label
|
||||
Dim la_zona As Label
|
||||
Dim la_entre1 As Label
|
||||
Dim la_entre2 As Label
|
||||
Dim gest As Button
|
||||
Dim la_saldotot As Label
|
||||
Dim la_saldooper As Label
|
||||
Dim la_saldof1 As Label
|
||||
Dim la_penal As Label
|
||||
Dim la_producto As Label
|
||||
Dim la_padre As Label
|
||||
Dim la_no_ird As Label
|
||||
|
||||
Dim Tels As Button
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
Activity.LoadLayout("info_gral")
|
||||
Dim ruta As String
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
|
||||
End If
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select pr_cd_credito,pr_cd_nombre,pr_cd_calle,pr_cd_numero,pr_cd_num_int,pr_cd_entrecalle1,pr_cd_entrecalle2,pr_cd_colonia,pr_cd_poblacion,pr_cd_edo,pr_cd_cp,pr_Cd_zona, pr_cf_saldotot,pr_cf_saldooper,pr_cf_saldof1, pr_cf_penalizacion, pr_kt_producto, Pr_Ca_Padre, Pr_Ca_No_Ird, PR_CA_CONVENIO,PR_CF_MTO_PRESTAMO,PR_CF_FECHA_DISP,PR_CF_SALDO_ACORT,PR_CF_SALDO_VEN,PR_CF_SALDO_PAGARE,PR_CF_CAPITAL from kmt_info where pr_cd_credito In (select cuenta from cuentaa)")
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
la_cuenta.Text = c.GetString("pr_cd_credito")
|
||||
La_nombre.Text = c.GetString("pr_cd_nombre")
|
||||
la_Calle.Text = c.GetString("pr_cd_calle")
|
||||
'la_numero.Text = c.GetString("pr_cd_numero")
|
||||
'la_nint.Text = c.GetString("pr_cd_num_int")
|
||||
la_entre1.Text = c.GetString("PR_CF_CAPITAL")
|
||||
'la_entre2.Text = c.GetString("pr_cd_entrecalle2")
|
||||
la_col.Text = c.GetString("pr_cd_colonia")
|
||||
la_pob.Text = c.GetString("pr_cd_poblacion")
|
||||
la_edo.Text = c.GetString("pr_cd_edo")
|
||||
la_cp.Text = c.GetString("pr_cd_cp")
|
||||
'la_zona.Text = c.GetString("pr_Cd_zona")
|
||||
la_saldotot.Text = c.GetString("PR_CA_CONVENIO")
|
||||
la_saldooper.Text = c.GetString("PR_CF_MTO_PRESTAMO")
|
||||
la_saldof1.Text = c.GetString("PR_CF_SALDO_VEN")
|
||||
la_penal.Text = c.GetString("PR_CF_SALDO_PAGARE")
|
||||
la_producto.Text = c.GetString("pr_kt_producto")
|
||||
la_padre.Text = c.GetString("PR_CF_FECHA_DISP")
|
||||
la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub gest_Click
|
||||
StartActivity(gestion)
|
||||
End Sub
|
||||
|
||||
Sub Tels_Click
|
||||
StartActivity(telefonos)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
209
foto.bas
Normal file
@@ -0,0 +1,209 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
|
||||
#End Region
|
||||
Sub Process_Globals
|
||||
Private frontCamera As Boolean = False
|
||||
Dim ruta As String
|
||||
Dim g As GPS
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
Private Panel1 As Panel
|
||||
Private camEx As CameraExClass
|
||||
Dim btnTakePicture As Button
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim cuenta As String
|
||||
Dim lat_gps As String
|
||||
Dim lon_gps As String
|
||||
Dim USUARIO As String
|
||||
Dim MOTIVO As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
Activity.LoadLayout("foto")
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select cuenta from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
InitializeCamera
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeCamera
|
||||
camEx.Initialize(Panel1, frontCamera, Me, "Camera1")
|
||||
frontCamera = camEx.Front
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
camEx.Release
|
||||
End Sub
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
'btnTakePicture.Enabled = True
|
||||
's.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE,HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps, lon_gps))
|
||||
End Sub
|
||||
|
||||
Sub Camera1_Ready (Success As Boolean)
|
||||
If Success Then
|
||||
camEx.SetJpegQuality(90)
|
||||
camEx.CommitParameters
|
||||
camEx.StartPreview
|
||||
Log(camEx.GetPreviewSize)
|
||||
Else
|
||||
ToastMessageShow("Cannot open camera.", True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub btnTakePicture_Click
|
||||
Dim ps As CameraSize
|
||||
ps.Width =640
|
||||
ps.Height =480
|
||||
camEx.SetPictureSize(ps.Width, ps.Height)
|
||||
'ToastMessageShow(ps.Width & "x" & ps.Height, False)
|
||||
camEx.CommitParameters
|
||||
camEx.TakePicture
|
||||
End Sub
|
||||
|
||||
Sub btnFocus_Click
|
||||
camEx.FocusAndTakePicture
|
||||
End Sub
|
||||
|
||||
Sub Camera1_PictureTaken (Data() As Byte)
|
||||
Dim filename As String = "1.jpg"
|
||||
Dim dir As String = File.DirRootExternal
|
||||
|
||||
camEx.SavePictureToFile(Data, dir, filename)
|
||||
camEx.StartPreview 'restart preview
|
||||
|
||||
'Dim out As OutputStream
|
||||
|
||||
Dim sDate,sTime As String
|
||||
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("select CUENTA from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position = 0
|
||||
USUARIO = c.GetString("USUARIO")
|
||||
c.Close
|
||||
skmt.ExecNonQuery("DELETE FROM NOVENTA WHERE NV_CLIENTE IN (select cuenta from cuentaa)")
|
||||
|
||||
c=skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
skmt.ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT) select HVD_CLIENTE, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT from hist_ventas where HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(c.GetString("HVD_PRONOMBRE")))
|
||||
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),c.GetString("HVD_PRONOMBRE")))
|
||||
' ANTES DE MODIFCAR
|
||||
'skmt.ExecNonQuery2("delete FROM HIST_VENTAS WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(c.GetString("HVD_PRONOMBRE")))
|
||||
'skmt.ExecNonQuery2("update HIST_VENTAS set HVD_EXISTE = ? WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(motivo, c.GetString("HVD_PRONOMBRE")))
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON, NV_FOTO) VALUES(?,?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, USUARIO, "CERRADO",nopago.COMENTARIO,lat_gps,lon_gps, Data))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
skmt.ExecNonQuery("update HIST_VENTAS SET HVD_ESTATUS = 2 WHERE HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
||||
StartActivity(seleccion)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub ChangeCamera_Click
|
||||
camEx.Release
|
||||
frontCamera = Not(frontCamera)
|
||||
InitializeCamera
|
||||
End Sub
|
||||
|
||||
Sub btnEffect_Click
|
||||
Dim effects As List = camEx.GetSupportedColorEffects
|
||||
If effects.IsInitialized = False Then
|
||||
ToastMessageShow("Effects not supported.", False)
|
||||
Return
|
||||
End If
|
||||
Dim effect As String = effects.Get((effects.IndexOf(camEx.GetColorEffect) + 1) Mod effects.Size)
|
||||
camEx.SetColorEffect(effect)
|
||||
ToastMessageShow(effect, False)
|
||||
camEx.CommitParameters
|
||||
End Sub
|
||||
|
||||
Sub btnFlash_Click
|
||||
Dim f() As Float = camEx.GetFocusDistances
|
||||
Log(f(0) & ", " & f(1) & ", " & f(2))
|
||||
Dim flashModes As List = camEx.GetSupportedFlashModes
|
||||
If flashModes.IsInitialized = False Then
|
||||
ToastMessageShow("Flash not supported.", False)
|
||||
Return
|
||||
End If
|
||||
Dim flash As String = flashModes.Get((flashModes.IndexOf(camEx.GetFlashMode) + 1) Mod flashModes.Size)
|
||||
camEx.SetFlashMode(flash)
|
||||
ToastMessageShow(flash, False)
|
||||
camEx.CommitParameters
|
||||
End Sub
|
||||
Sub btnPictureSize_Click
|
||||
Dim pictureSizes() As CameraSize = camEx.GetSupportedPicturesSizes
|
||||
Dim current As CameraSize = camEx.GetPictureSize
|
||||
For i = 0 To pictureSizes.Length - 1
|
||||
If pictureSizes(i).Width = current.Width And pictureSizes(i).Height = current.Height Then Exit
|
||||
Next
|
||||
Dim ps As CameraSize = pictureSizes((i + 1) Mod pictureSizes.Length)
|
||||
camEx.SetPictureSize(ps.Width, ps.Height)
|
||||
ToastMessageShow(ps.Width & "x" & ps.Height & i, False)
|
||||
camEx.CommitParameters
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
271
gestion.bas
Normal file
@@ -0,0 +1,271 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim g As GPS
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim s As SQL
|
||||
Dim c As Cursor
|
||||
Dim nombre As EditText
|
||||
Dim btn As Button
|
||||
Dim lv As ListView
|
||||
Dim telefono As EditText
|
||||
Dim lb_gps As Label
|
||||
Dim lat_gps As String
|
||||
Dim lon_gps As String
|
||||
|
||||
Dim contacto As EditText
|
||||
Dim Resultado As EditText
|
||||
Dim comentario As EditText
|
||||
Dim codigos As Button
|
||||
Dim parent As Button
|
||||
Dim quien_llamo As String
|
||||
Dim fecha As EditText
|
||||
Dim l_fecha As Label
|
||||
Dim l_monto As Label
|
||||
Dim monto As EditText
|
||||
Dim cuantos As String
|
||||
Dim l_comentario As Label
|
||||
Dim l_ird1 As Label
|
||||
Dim ird1 As EditText
|
||||
Dim l_ird2 As Label
|
||||
Dim ird2 As EditText
|
||||
Dim l_ird3 As Label
|
||||
Dim ird3 As EditText
|
||||
Dim l_ird4 As Label
|
||||
Dim ird4 As EditText
|
||||
Dim despues As Button
|
||||
Dim cuenta As String
|
||||
Dim usuario As String
|
||||
Dim result As String
|
||||
Dim pondera As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
Activity.LoadLayout("guardagestion")
|
||||
|
||||
|
||||
Dim ruta As String
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
s.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
monto.Visible = False
|
||||
l_monto.Visible = False
|
||||
l_fecha.Visible = False
|
||||
fecha.Visible = False
|
||||
contacto.Text = ""
|
||||
Resultado.Text= ""
|
||||
comentario.Text =""
|
||||
monto.Text = ""
|
||||
fecha.Text = ""
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
g.Start(0,0)
|
||||
End Sub
|
||||
Sub btn_Click
|
||||
If Resultado.text<>"" And contacto.Text<>"" And comentario.text<>"" Then
|
||||
' c=s.ExecQuery("select pr_cd_credito,pr_cd_nombre,pr_cd_calle,pr_cd_numero,pr_cd_num_int,pr_cd_entrecalle1,pr_cd_entrecalle2,pr_cd_colonia,pr_cd_poblacion,pr_cd_edo,pr_cd_cp,pr_Cd_zona, pr_cf_saldotot,pr_cf_saldooper,pr_cf_saldof1, pr_cf_penalizacion, pr_kt_producto, Pr_Ca_Padre, Pr_Ca_No_Ird from kmt_info where pr_cd_credito In (select cuenta from cuentaa)")
|
||||
'ESTO SE NECESITA PARA SACAR LOS VALORES Y COMPARAR LOS IRD
|
||||
' c.Position=0
|
||||
' Dim la_cuenta As String = c.GetString("pr_cd_credito")
|
||||
' Dim La_nombre As String = c.GetString("pr_cd_nombre")
|
||||
' la_Calle.Text = c.GetString("pr_cd_calle")
|
||||
' la_numero.Text = c.GetString("pr_cd_numero")
|
||||
' la_nint.Text = c.GetString("pr_cd_num_int")
|
||||
' la_entre1.Text = c.GetString("pr_cd_entrecalle1")
|
||||
' la_entre2.Text = c.GetString("pr_cd_entrecalle2")
|
||||
' la_col.Text = c.GetString("pr_cd_colonia")
|
||||
' la_pob.Text = c.GetString("pr_cd_poblacion")
|
||||
' la_edo.Text = c.GetString("pr_cd_edo")
|
||||
' la_cp.Text = c.GetString("pr_cd_cp")
|
||||
' la_zona.Text = c.GetString("pr_Cd_zona")
|
||||
' la_saldotot.Text = c.GetString("pr_cf_saldotot")
|
||||
' la_saldooper.Text = c.GetString("pr_cf_saldooper")
|
||||
' la_saldof1.Text = c.GetString("pr_cf_saldof1")
|
||||
' la_penal.Text = c.GetString("pr_cf_penalizacion")
|
||||
' la_producto.Text = c.GetString("pr_kt_producto")
|
||||
' la_padre.Text = c.GetString("Pr_Ca_Padre")
|
||||
' la_no_ird.Text = c.GetString("Pr_Ca_No_Ird")
|
||||
|
||||
c=s.ExecQuery("select CUENTA from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
c=s.ExecQuery("select usuario from usuarioa")
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
c=s.ExecQuery2("select CRDESC,CRCOD AS CODIGO,CRPROD from cod_result WHERE CRDESC = ? ", Array As String(Resultado.Text))
|
||||
c.Position = 0
|
||||
result = c.GetString("CODIGO")
|
||||
'pondera = c.GetString("CAT_CO_PONDERACION")
|
||||
Dim sDate,sTime As String
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
s.ExecNonQuery("UPDATE kmt_info set gestion = 1 where MGCTA In (select cuenta from cuentaa)")
|
||||
s.ExecNonQuery2("UPDATE hist_visitas SET HIST_VI_VISITADOR = ?, HIST_VI_RESULTADO = ?, HIST_VI_CODIGO = ?, HIST_VI_PARENTESCO = ?, HIST_VI_COMENTARIO =?, HIST_VI_DPROM =?, HIST_VI_MPROM =? WHERE HIST_VI_CREDITO = ? ", Array As Object(usuario,Resultado.Text,result,contacto.text, comentario.Text,fecha.text,monto.Text, cuenta))
|
||||
'datetime(updatedon,'localtime')
|
||||
'CallSubDelayed(foto,"foto")
|
||||
StartActivity(seleccion)
|
||||
End If
|
||||
End Sub
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
Dim sDate,sTime As String
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
's.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE,HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, lat_gps, lon_gps))
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub codigos_Click
|
||||
quien_llamo = "codigo"
|
||||
c=s.ExecQuery("select COUNT(*) AS CUANTOS from COD_RESULT WHERE CRPROD IN (select productoa from productoa)")
|
||||
c.Position=0
|
||||
cuantos = c.GetString("CUANTOS")
|
||||
If cuantos = 0 Then
|
||||
lv.Clear
|
||||
lv.AddSingleLine("SIN CODIGOS")
|
||||
|
||||
Else
|
||||
c=s.ExecQuery("select CRDESC AS DESC, CRCOD from COD_RESULT WHERE CRPROD IN (select productoa from productoa) ORDER BY CRDESC ASC")
|
||||
lv.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
lv.AddSingleLine(c.GetString("DESC"))
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Sub lv_ItemClick (Position As Int, Value As Object)
|
||||
Dim es_c_promesa As String
|
||||
If quien_llamo = "codigo" Then
|
||||
Resultado.Text = Value
|
||||
If Resultado.Text <> "EQUIPO RECUPERADO" Then
|
||||
comentario.Visible = True
|
||||
l_comentario.Visible = True
|
||||
l_ird1.Visible = False
|
||||
ird1.Visible = False
|
||||
l_ird2.Visible = False
|
||||
ird2.Visible = False
|
||||
l_ird3.Visible = False
|
||||
ird3.Visible = False
|
||||
l_ird4.Visible = False
|
||||
ird4.Visible = False
|
||||
|
||||
' c=s.ExecQuery2("select CAT_CO_CONFIGURACION from CAT_CODIGOS WHERE CAT_CO_RDESCRIPCION = ? ", Array As String(Value))
|
||||
' c.Position=0
|
||||
' es_c_promesa=c.GetString("CAT_CO_CONFIGURACION")
|
||||
If Resultado.Text = "PROMESA DE PAGO" Then
|
||||
monto.Visible = True
|
||||
l_monto.Visible = True
|
||||
l_fecha.Visible = True
|
||||
fecha.Visible = True
|
||||
Else
|
||||
monto.Visible = False
|
||||
l_monto.Visible = False
|
||||
l_fecha.Visible = False
|
||||
fecha.Visible = False
|
||||
|
||||
End If
|
||||
Else
|
||||
comentario.Visible = False
|
||||
l_comentario.Visible = False
|
||||
l_ird1.Visible = True
|
||||
ird1.Visible = True
|
||||
l_ird2.Visible = True
|
||||
ird2.Visible = True
|
||||
l_ird3.Visible = True
|
||||
ird3.Visible = True
|
||||
l_ird4.Visible = True
|
||||
ird4.Visible = True
|
||||
End If
|
||||
|
||||
Else
|
||||
contacto.Text = Value
|
||||
End If
|
||||
lv.Clear
|
||||
End Sub
|
||||
Sub parent_Click
|
||||
quien_llamo = "parent"
|
||||
c=s.ExecQuery("select CAT_PA_ID, CAT_PA_PARENTESCO from CAT_PARENTESCO order by CAT_PA_PARENTESCO asc")
|
||||
lv.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
lv.AddSingleLine(c.GetString("CAT_PA_PARENTESCO"))
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
Sub despues_Click
|
||||
s.ExecNonQuery("UPDATE kmt_info set gestion = 2 where pr_cd_credito In (select cuenta from cuentaa)")
|
||||
's.ExecNonQuery2("insert into hist_Act (htel, hanombre) values (?,datetime(updatedon,'localtime'))" Array As String(cuantos))
|
||||
|
||||
'CallSubDelayed(foto,"foto")
|
||||
StartActivity(colonia)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
|
||||
|
||||
38
kmt1.b4a.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
VisibleModules=1,2,3,4,5,6,7,8,12
|
||||
ModuleBreakpoints0=
|
||||
ModuleClosedNodes0=
|
||||
ModuleBreakpoints1=
|
||||
ModuleClosedNodes1=1,6,7,9,11,12,13,14,15,16
|
||||
ModuleBreakpoints2=
|
||||
ModuleClosedNodes2=1
|
||||
ModuleBreakpoints3=
|
||||
ModuleClosedNodes3=1
|
||||
ModuleBreakpoints4=
|
||||
ModuleClosedNodes4=
|
||||
ModuleBreakpoints5=
|
||||
ModuleClosedNodes5=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
|
||||
ModuleBreakpoints6=
|
||||
ModuleClosedNodes6=1
|
||||
ModuleBreakpoints7=
|
||||
ModuleClosedNodes7=1,8,9
|
||||
ModuleBreakpoints8=
|
||||
ModuleClosedNodes8=1,2,3,4,6,8,10,11,12,13,14
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes9=1,2,3,4,5,6
|
||||
ModuleBreakpoints10=
|
||||
ModuleClosedNodes10=1
|
||||
ModuleBreakpoints11=
|
||||
ModuleClosedNodes11=
|
||||
ModuleBreakpoints12=
|
||||
ModuleClosedNodes12=1
|
||||
ModuleBreakpoints13=
|
||||
ModuleClosedNodes13=1
|
||||
ModuleBreakpoints14=
|
||||
ModuleClosedNodes14=1
|
||||
ModuleBreakpoints15=
|
||||
ModuleClosedNodes15=1
|
||||
ModuleBreakpoints16=
|
||||
ModuleClosedNodes16=
|
||||
ModuleBreakpoints17=
|
||||
ModuleClosedNodes17=
|
||||
SelectedBuild=0
|
||||
128
mapas.bas
Normal file
@@ -0,0 +1,128 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
Dim GPS As GPS
|
||||
Dim rp As RuntimePermissions
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
Private gmap As GoogleMap
|
||||
Private MapFragment1 As MapFragment
|
||||
Dim Latitud As Double = 0
|
||||
Dim Longitud As Double = 0
|
||||
Dim Lat2 As Double = 0
|
||||
Dim Lon2 As Double = 0
|
||||
Dim p1, p2 As Location
|
||||
Dim Distance As Float
|
||||
Dim boton1 As Button
|
||||
Dim c As Cursor
|
||||
Dim latmarker As Double
|
||||
Dim longmarker As Double
|
||||
Private l_long As Label
|
||||
Private l_lat As Label
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
Activity.LoadLayout("1")
|
||||
If MapFragment1.IsGooglePlayServicesAvailable = False Then
|
||||
ToastMessageShow("Please install Google Play Services.", True)
|
||||
End If
|
||||
|
||||
'Boton velocidad'
|
||||
boton1.Initialize(0)
|
||||
boton1.Text = 0 &" "&"km/h"
|
||||
boton1.TextColor = Colors.Red
|
||||
boton1.TextSize = 15
|
||||
Activity.AddView(boton1, 40%x, 5dip, 25%x, 40dip)
|
||||
|
||||
'Fin Boton velocidad'
|
||||
End Sub
|
||||
|
||||
Sub MapFragment1_Ready
|
||||
gmap = MapFragment1.GetMap
|
||||
|
||||
'permisos
|
||||
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
gmap.MyLocationEnabled = Result
|
||||
'fin de permisos
|
||||
|
||||
Dim JavaMapsObject As JavaObject
|
||||
JavaMapsObject = gmap.GetUiSettings
|
||||
JavaMapsObject.RunMethod("setMapToolbarEnabled", Array As Object(True))
|
||||
|
||||
'marcadores
|
||||
' Dim latmarker As Double =19.3931867
|
||||
' Dim longmarker As Double =-99.1439178
|
||||
latmarker = fila.LATITUD
|
||||
longmarker = fila.LONGITUD
|
||||
Dim marcador1 As Marker = gmap.AddMarker (latmarker,longmarker, "TIENDA")
|
||||
marcador1.Snippet = fila.NOMBRE
|
||||
'"Tienda 1"
|
||||
|
||||
|
||||
'posicion inicial
|
||||
Dim aa As CameraPosition
|
||||
aa.Initialize(latmarker,longmarker,15)''' RECOMENDABLE CAMBIAR A 10 SI ES MAS DE 1 MARCADOR
|
||||
gmap.AnimateCamera(aa)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Sub GPS_LocationChanged (Parametro As Location)
|
||||
Dim sp As Int
|
||||
|
||||
sp = Ceil(Parametro.Speed * 3.6)
|
||||
boton1.Text = sp &" "&"km/h"
|
||||
Latitud = Parametro.Latitude
|
||||
Longitud = Parametro.Longitude
|
||||
p2.Initialize2(Latitud,Longitud)
|
||||
p1.Initialize2(Lat2, Lon2)
|
||||
Distance = p1.DistanceTo(p2)
|
||||
If Latitud <> 0 And Longitud <> 0 Then
|
||||
If Distance > 10 Then
|
||||
Lat2 = Latitud
|
||||
Lon2 = Longitud
|
||||
Dim cp As CameraPosition
|
||||
cp.Initialize2(Parametro.Latitude, Parametro.Longitude, gmap.CameraPosition.Zoom, Parametro.Bearing, 0)
|
||||
gmap.AnimateCamera(cp)
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
GPS.Initialize("GPS")
|
||||
|
||||
If GPS.GPSEnabled = False Then
|
||||
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
|
||||
StartActivity(GPS.LocationSettingsIntent)
|
||||
Else
|
||||
GPS.Start(0, 0)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
GPS.Stop
|
||||
End Sub
|
||||
|
||||
Sub reg_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
139
nopago.bas
Normal file
@@ -0,0 +1,139 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim g As GPS
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
Dim COMENTARIO As String
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
Dim CANCELA As Button
|
||||
Dim GUARDA As Button
|
||||
Dim r_1 As RadioButton
|
||||
Dim r_2 As RadioButton
|
||||
Dim r_3 As RadioButton
|
||||
Dim e_comm As EditText
|
||||
Dim motivo As String
|
||||
Dim cuenta As String
|
||||
Dim usuario As String
|
||||
Dim sDate,sTime As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
|
||||
Dim r_4 As RadioButton
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
|
||||
Activity.LoadLayout("nopago")
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
|
||||
End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
e_comm.Text=""
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
g.Start(0,0)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub CANCELA_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub GUARDA_Click
|
||||
If r_1.Checked Then
|
||||
motivo = "CERRADO"
|
||||
Else If r_2.Checked Then
|
||||
motivo = "NO PIDIO"
|
||||
Else If r_3.Checked Then
|
||||
motivo = "CANCELA"
|
||||
Else
|
||||
motivo = "NO ESTA EL ENCARGADO"
|
||||
End If
|
||||
If motivo <> "CERRADO" Then
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("select CUENTA from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select usuario from usuarioa")
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
c.Close
|
||||
skmt.ExecNonQuery("DELETE FROM NOVENTA WHERE NV_CLIENTE IN (select cuenta from cuentaa)")
|
||||
|
||||
c=skmt.ExecQuery("select HVD_CLIENTE,HVD_PRONOMBRE,HVD_CANT,HVD_COSTO_TOT, HVD_FECHA from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa) order by HVD_PRONOMBRE asc")
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
skmt.ExecNonQuery2("insert into reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT,REP_FECHA) VALUES (?,?,?,?,?) ", Array As String(c.GetString("HVD_CLIENTE"),c.GetString("HVD_PRONOMBRE"),c.GetString("HVD_CANT"),c.GetString("HVD_COSTO_TOT"),c.GetString("HVD_FECHA")))
|
||||
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_nombre = ?", Array As Object(c.GetString("HVD_CANT"),c.GetString("HVD_PRONOMBRE")))
|
||||
' ANTES DE MODIFCAR
|
||||
'skmt.ExecNonQuery2("delete FROM HIST_VENTAS WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(c.GetString("HVD_PRONOMBRE")))
|
||||
'skmt.ExecNonQuery2("update HIST_VENTAS set HVD_EXISTE = ? WHERE HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(motivo, c.GetString("HVD_PRONOMBRE")))
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, usuario, motivo,e_comm.text,lat_gps,lon_gps))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
skmt.ExecNonQuery("update HIST_VENTAS SET HVD_ESTATUS = 2 WHERE HVD_CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
||||
|
||||
StartActivity(seleccion)
|
||||
Else
|
||||
COMENTARIO = e_comm.Text
|
||||
StartActivity(foto)
|
||||
End If
|
||||
End Sub
|
||||
106
nuevocliente.bas
Normal file
@@ -0,0 +1,106 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim g As GPS
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
Dim c As Cursor
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
Dim CANCELA As Button
|
||||
Dim GUARDA As Button
|
||||
Dim cuenta As String
|
||||
Dim usuario As String
|
||||
Dim sDate,sTime As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
Dim no_cliente As String
|
||||
Dim no_ruta As String
|
||||
|
||||
Dim r_4 As RadioButton
|
||||
Dim E_NOMBRE As EditText
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
|
||||
Activity.LoadLayout("nuevocliente")
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
|
||||
End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
E_NOMBRE.Text = ""
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
g.Start(0,0)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub CANCELA_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub GUARDA_Click
|
||||
If E_NOMBRE.Text = "" Then
|
||||
ToastMessageShow("Se tiene que nombrar la tienda para continuar" , True)
|
||||
Else
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA FROM kmt_info")
|
||||
c.Position=0
|
||||
no_ruta= c.GetString("CAT_CL_RUTA")
|
||||
no_cliente= "N" & sTime & no_ruta
|
||||
c.Close
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT, gestion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null","null","null"))
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
|
||||
StartActivity(fila)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
621
pedidos.bas
Normal file
@@ -0,0 +1,621 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim g As GPS
|
||||
Dim ruta As String
|
||||
Dim skmt As SQL
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim c As Cursor
|
||||
Dim e As Cursor
|
||||
Dim f As Cursor
|
||||
Dim h As Cursor
|
||||
Dim l_tipo As Label
|
||||
Dim l_sub As Label
|
||||
Dim l_marca As Label
|
||||
Dim l_desc As Label
|
||||
Dim l_precio As Label
|
||||
Dim l_bodega As Label
|
||||
Dim cantidad As EditText
|
||||
Dim guardar As Button
|
||||
Dim Terminar As Button
|
||||
Dim img_prod As ImageView
|
||||
Dim IMG_PASO() As Byte
|
||||
Dim L_PROID As Label
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
Dim t_venta As Label
|
||||
Dim PROMO_C As String
|
||||
Dim i_fotol As ImageView
|
||||
Private DESC_PROMO As Button
|
||||
Private nopromo As Button
|
||||
Dim TOT_ART_PROMO As String
|
||||
Dim cambio As String
|
||||
Dim COSTO_TOT As String
|
||||
Dim ALMACEN As String
|
||||
Dim preciosin As String
|
||||
Dim cl_ruta As String
|
||||
Dim d As Cursor
|
||||
Dim TOT_ART_PROMOR As String
|
||||
Dim PROMO_CR As String
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
Activity.LoadLayout("pedido")
|
||||
i_fotol.Visible = False
|
||||
|
||||
' valido donde escribo el archivo de la base de datos de kmt
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
|
||||
End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_DEV from CAT_GUNAPROD where CAT_GP_NOMBRE In (Select PDESC from PROID)")
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
L_PROID.Text = c.GetString("CAT_GP_ID")
|
||||
l_tipo.Text = c.GetString("CAT_GP_TIPO")
|
||||
l_sub.Text = c.GetString("CAT_GP_SUBTIPO")
|
||||
l_marca.Text = c.GetString("CAT_GP_CLASIF")
|
||||
l_desc.Text = c.GetString("CAT_GP_NOMBRE")
|
||||
l_precio.Text = c.GetDouble("CAT_GP_PRECIO")
|
||||
l_bodega.Text = c.GetString("CAT_GP_ALMACEN")
|
||||
IMG_PASO = c.GetBlob("CAT_GP_IMG")
|
||||
PROMO_C = c.GetString("CAT_GP_STS")
|
||||
cambio = c.GetString("CAT_GP_DEV")
|
||||
preciosin = c.GetString("CAT_GP_IMP2")
|
||||
cambio = "0"
|
||||
c.Close
|
||||
c=skmt.ExecQuery("select CASE WHEN pe_costo_tot is null then 0 else sum( pe_costo_tot ) end as TOTAL_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
t_venta.Text = c.GetString("TOTAL_CLIE")
|
||||
c.Close
|
||||
|
||||
|
||||
Dim out As OutputStream
|
||||
out = File.OpenOutput(ruta, "1.jpg", False)
|
||||
out.WriteBytes(IMG_PASO, 0, IMG_PASO.Length)
|
||||
out.Close
|
||||
img_prod.Bitmap = LoadBitmap(ruta,"1.jpg")
|
||||
|
||||
'la_padre.Text = c.GetString("PR_CF_FECHA_DISP")
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
cantidad.Text = ""
|
||||
c=skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
C.Position =0
|
||||
ALMACEN = C.GetString("ID_ALMACEN")
|
||||
C.Close
|
||||
i_fotol.Visible = False
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_DEV from CAT_GUNAPROD where CAT_GP_NOMBRE In (Select PDESC from PROID)")
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
L_PROID.Text = c.GetString("CAT_GP_ID")
|
||||
l_tipo.Text = c.GetString("CAT_GP_TIPO")
|
||||
l_sub.Text = c.GetString("CAT_GP_SUBTIPO")
|
||||
l_marca.Text = c.GetString("CAT_GP_CLASIF")
|
||||
l_desc.Text = c.GetString("CAT_GP_NOMBRE")
|
||||
l_precio.Text = c.GetDouble("CAT_GP_PRECIO")
|
||||
l_bodega.Text = c.GetString("CAT_GP_ALMACEN")
|
||||
IMG_PASO = c.GetBlob("CAT_GP_IMG")
|
||||
PROMO_C = c.GetString("CAT_GP_STS")
|
||||
cambio = c.GetString("CAT_GP_DEV")
|
||||
preciosin = c.GetString("CAT_GP_IMP2")
|
||||
PROMO_CR = c.GetString("CAT_GP_IMP1")
|
||||
|
||||
|
||||
cambio = "0"
|
||||
|
||||
c.Close
|
||||
If l_marca.text = "PROMOS" And l_tipo.Text ="PROMOS" Then
|
||||
DESC_PROMO.Visible = True
|
||||
Else
|
||||
DESC_PROMO.Visible = False
|
||||
End If
|
||||
|
||||
c=skmt.ExecQuery("select CASE WHEN pe_costo_tot is null then 0 else sum( pe_costo_tot ) end as TOTAL_CLIE FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
t_venta.Text = c.GetString("TOTAL_CLIE")
|
||||
c.Close
|
||||
' If t_venta.Text < 100 AND l_tipo.Text = "PROMOS" Then
|
||||
'Terminar.Visible = False
|
||||
'guardar.Visible = False
|
||||
'cantidad.Visible = False
|
||||
'nopromo.Visible = True
|
||||
'Else
|
||||
Terminar.Visible = True
|
||||
guardar.Visible = True
|
||||
cantidad.Visible = True
|
||||
If cambio = "1" Then
|
||||
nopromo.Visible = True
|
||||
Else
|
||||
nopromo.Visible = False
|
||||
End If
|
||||
'End If
|
||||
|
||||
Dim out As OutputStream
|
||||
out = File.OpenOutput(ruta, "1.jpg", False)
|
||||
out.WriteBytes(IMG_PASO, 0, IMG_PASO.Length)
|
||||
out.Close
|
||||
img_prod.Bitmap = LoadBitmap(ruta,"1.jpg")
|
||||
TOT_ART_PROMO = "0"
|
||||
TOT_ART_PROMOR = "0"
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
g.Start(0,0)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub guardar_Click
|
||||
If cantidad.Text > l_bodega.Text Then
|
||||
Msgbox("Exede la existencia", "ADVERTENCIA")
|
||||
Else If l_marca.text = "PROMOS" And l_tipo.Text ="PROMOS" And PROMO_C > 0 And cantidad.Text > 0 Then
|
||||
skmt.ExecNonQuery("delete from PROIDID")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PROIDID VALUES (?)", Array As Object(L_PROID.text))
|
||||
c=skmt.ExecQuery("Select count(*) as CUANTOSD from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0)")
|
||||
c.Position =0
|
||||
If c.GetString("CUANTOSD") = 0 Then
|
||||
Msgbox("No tiene venta el cliente para la promo", "ADVERTENCIA")
|
||||
Else
|
||||
c=skmt.ExecQuery("Select sum(pe_cant) As TOT_ART_PROMO, sum(PE_COSTO_TOT) as COSTO_TOT from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0)")
|
||||
C.Position =0
|
||||
TOT_ART_PROMO = C.GetString("TOT_ART_PROMO")
|
||||
COSTO_TOT = C.GetString("COSTO_TOT")
|
||||
C.Close
|
||||
|
||||
c=skmt.ExecQuery("Select count(*) as CUANTOSD from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1)")
|
||||
c.Position =0
|
||||
If c.GetString("CUANTOSD") = 0 Then
|
||||
TOT_ART_PROMOR = "0" 'Msgbox("No tiene venta el cliente para la promo", "ADVERTENCIA")
|
||||
Else
|
||||
c=skmt.ExecQuery("Select sum(pe_cant) As TOT_ART_PROMO, sum(PE_COSTO_TOT) as COSTO_TOT from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1)")
|
||||
C.Position =0
|
||||
TOT_ART_PROMOR = C.GetString("TOT_ART_PROMO")
|
||||
End If
|
||||
C.Close
|
||||
|
||||
|
||||
PROMO_C = PROMO_C * cantidad.Text
|
||||
PROMO_CR = PROMO_CR * cantidad.Text
|
||||
|
||||
If TOT_ART_PROMO = PROMO_C And TOT_ART_PROMOR = PROMO_CR Then
|
||||
' anterior a 29/06/2015
|
||||
'skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))", Array As Object(l_precio.text/(TOT_ART_PROMO/cantidad.Text),l_precio.text/(TOT_ART_PROMO/cantidad.Text)))
|
||||
'en pe_cedis meto el codigo de promocion para hacer esta validacion.
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_CEDIS = (?) WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))", Array As Object(L_PROID.text))
|
||||
D=skmt.ExecQuery("select CAT_DP_ID, CAT_DP_PRECIO, CAT_DP_PRECIO_SIMPTOS, CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0")
|
||||
If D.RowCount>0 Then
|
||||
For i=0 To D.RowCount -1
|
||||
D.Position=i
|
||||
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) , PE_COSTO_SIN = (?) WHERE PE_PROID = (?) And PE_CEDIS In (Select PROIDID from PROIDID) AND PE_CLIENTE IN (Select CUENTA from cuentaa) ",Array As Object( D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO_SIMPTOS"),D.GetString("CAT_DP_IDPROD")))
|
||||
|
||||
Next
|
||||
End If
|
||||
D.Close
|
||||
D=skmt.ExecQuery("select CAT_DP_ID, CAT_DP_PRECIO, CAT_DP_PRECIO_SIMPTOS, CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1")
|
||||
If D.RowCount>0 Then
|
||||
For i=0 To D.RowCount -1
|
||||
D.Position=i
|
||||
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) , PE_COSTO_SIN = (?) WHERE PE_PROID = (?) And PE_CEDIS In (Select PROIDID from PROIDID) AND PE_CLIENTE IN (Select CUENTA from cuentaa) ",Array As Object( D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO_SIMPTOS"),D.GetString("CAT_DP_IDPROD")))
|
||||
|
||||
Next
|
||||
End If
|
||||
D.Close
|
||||
|
||||
|
||||
|
||||
'skmt.ExecNonQuery("UPDATE PEDIDO SET PE_COSTO_TOT = 0.01 WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))")
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO) VALUES(?,?,?,?,?,?,?,?,?) ", Array As Object ("COACALCO",cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario))
|
||||
'para insertar la promo de ades el de regalo en 0
|
||||
e=skmt.ExecQuery("select count(*) as CUANTOS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) and CAT_DP_TIPO = 0 AND CAT_DP_PRECIO = 0")
|
||||
e.Position =0
|
||||
If e.GetString("CUANTOS") > 0 Then
|
||||
F=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) and CAT_DP_TIPO = 0 AND CAT_DP_PRECIO = 0")
|
||||
F.Position =0
|
||||
h=skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(f.GetString("CAT_DP_IDPROD")))
|
||||
h.Position=0
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, f.GetString("CAT_DP_PZAS") * cantidad.text, h.GetString("CAT_GP_NOMBRE"), f.GetString("CAT_DP_IDPROD"),clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
h.Close
|
||||
f.Close
|
||||
End If
|
||||
e.Close
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
Else
|
||||
Msgbox("Tiene " & TOT_ART_PROMO & " " & TOT_ART_PROMOR & " y necesita " & PROMO_C & " " & PROMO_CR & " Para la Promo. " , "ADVERTENCIA")
|
||||
End If
|
||||
End If
|
||||
|
||||
cantidad.Text = ""
|
||||
StartActivity(colonia2)
|
||||
else If l_marca.text = "PROMOS" And l_tipo.Text ="PROMOS" And PROMO_C = 0 Then
|
||||
skmt.ExecNonQuery("delete from PROIDID")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PROIDID VALUES (?)", Array As Object(L_PROID.text))
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
|
||||
c.Close
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO) VALUES(?,?,?,?,?,?,?,?,?) ", Array As Object ("COACALCO",cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario))
|
||||
'para insertar la promo de ades el de regalo en 0
|
||||
e=skmt.ExecQuery("select count(*) as CUANTOS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) ")
|
||||
e.Position =0
|
||||
If e.GetString("CUANTOS") > 0 Then
|
||||
F=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)")
|
||||
For i =0 To f.RowCount -1
|
||||
F.Position =i
|
||||
h=skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(f.GetString("CAT_DP_IDPROD")))
|
||||
h.Position=0
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,f.GetString("CAT_DP_PRECIO") * cantidad.text * f.GetString("CAT_DP_PZAS"), f.GetString("CAT_DP_PRECIO"), f.GetString("CAT_DP_PZAS") * cantidad.text, h.GetString("CAT_GP_NOMBRE"), f.GetString("CAT_DP_IDPROD"),clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
h.Close
|
||||
Next
|
||||
f.Close
|
||||
End If
|
||||
e.Close
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
cantidad.Text = ""
|
||||
c=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
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"), lon_gps, lat_gps,ALMACEN,cl_ruta,c.GetString("TOTAL_CLIE_SIN")))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
|
||||
StartActivity(colonia2)
|
||||
|
||||
Else
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c.Close
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'agregar el query para que todo cuadre
|
||||
' skmt.ExecNonQuery2("delete from reparto(REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT) select HVD_CLIENTE, HVD_PRONOMBRE, HVD_CANT, HVD_COSTO_TOT from hist_ventas where HVD_PRONOMBRE = ? and HVD_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN) VALUES(?,?,?,?,?,?,?,?,?,?,?) ", Array As Object (ALMACEN,cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta,preciosin))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
c=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
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"), lon_gps, lat_gps,ALMACEN,cl_ruta,c.GetString("TOTAL_CLIE_SIN")))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
StartActivity(colonia2)
|
||||
End If
|
||||
End Sub
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
Sub Terminar_Click
|
||||
If cantidad.Text > l_bodega.Text Then
|
||||
Msgbox("Exede la existencia", "ADVERTENCIA")
|
||||
Else If l_marca.text = "PROMOS" And l_tipo.Text ="PROMOS" And PROMO_C > 0 And cantidad.Text > 0 Then
|
||||
skmt.ExecNonQuery("delete from PROIDID")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PROIDID VALUES (?)", Array As Object(L_PROID.text))
|
||||
c=skmt.ExecQuery("Select count(*) as CUANTOSD from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0)")
|
||||
c.Position =0
|
||||
If c.GetString("CUANTOSD") = 0 Then
|
||||
Msgbox("No tiene venta el cliente para la promo", "ADVERTENCIA")
|
||||
Else
|
||||
c=skmt.ExecQuery("Select sum(pe_cant) As TOT_ART_PROMO, sum(PE_COSTO_TOT) as COSTO_TOT from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0)")
|
||||
C.Position =0
|
||||
TOT_ART_PROMO = C.GetString("TOT_ART_PROMO")
|
||||
COSTO_TOT = C.GetString("COSTO_TOT")
|
||||
C.Close
|
||||
|
||||
c=skmt.ExecQuery("Select count(*) as CUANTOSD from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1)")
|
||||
c.Position =0
|
||||
If c.GetString("CUANTOSD") = 0 Then
|
||||
TOT_ART_PROMOR = "0" 'Msgbox("No tiene venta el cliente para la promo", "ADVERTENCIA")
|
||||
Else
|
||||
c=skmt.ExecQuery("Select sum(pe_cant) As TOT_ART_PROMO, sum(PE_COSTO_TOT) as COSTO_TOT from pedido where PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1)")
|
||||
C.Position =0
|
||||
TOT_ART_PROMOR = C.GetString("TOT_ART_PROMO")
|
||||
End If
|
||||
C.Close
|
||||
|
||||
|
||||
PROMO_C = PROMO_C * cantidad.Text
|
||||
PROMO_CR = PROMO_CR * cantidad.Text
|
||||
|
||||
If TOT_ART_PROMO = PROMO_C And TOT_ART_PROMOR = PROMO_CR Then
|
||||
' anterior a 29/06/2015
|
||||
'skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))", Array As Object(l_precio.text/(TOT_ART_PROMO/cantidad.Text),l_precio.text/(TOT_ART_PROMO/cantidad.Text)))
|
||||
'en pe_cedis meto el codigo de promocion para hacer esta validacion.
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_CEDIS = (?) WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))", Array As Object(L_PROID.text))
|
||||
D=skmt.ExecQuery("select CAT_DP_ID, CAT_DP_PRECIO, CAT_DP_PRECIO_SIMPTOS, CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) AND CAT_DP_PRECIO > 0")
|
||||
If D.RowCount>0 Then
|
||||
For i=0 To D.RowCount -1
|
||||
D.Position=i
|
||||
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) , PE_COSTO_SIN = (?) WHERE PE_PROID = (?) And PE_CEDIS In (Select PROIDID from PROIDID) AND PE_CLIENTE IN (Select CUENTA from cuentaa) ",Array As Object( D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO_SIMPTOS"),D.GetString("CAT_DP_IDPROD")))
|
||||
|
||||
Next
|
||||
End If
|
||||
D.Close
|
||||
D=skmt.ExecQuery("select CAT_DP_ID, CAT_DP_PRECIO, CAT_DP_PRECIO_SIMPTOS, CAT_DP_IDPROD FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) AND CAT_DP_PRECIO = 0 AND CAT_DP_TIPO = 1")
|
||||
If D.RowCount>0 Then
|
||||
For i=0 To D.RowCount -1
|
||||
D.Position=i
|
||||
|
||||
skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_COSTOU = (?), PE_COSTO_TOT = PE_CANT * (?) , PE_COSTO_SIN = (?) WHERE PE_PROID = (?) And PE_CEDIS In (Select PROIDID from PROIDID) AND PE_CLIENTE IN (Select CUENTA from cuentaa) ",Array As Object( D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO"), D.GetString("CAT_DP_PRECIO_SIMPTOS"),D.GetString("CAT_DP_IDPROD")))
|
||||
|
||||
Next
|
||||
End If
|
||||
D.Close
|
||||
|
||||
|
||||
|
||||
'skmt.ExecNonQuery("UPDATE PEDIDO SET PE_COSTO_TOT = 0.01 WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) and pe_proid In (Select cat_dp_idprod from CAT_DETALLES_PAQ WHERE CAT_DP_ID In (Select PROIDID from PROIDID))")
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO) VALUES(?,?,?,?,?,?,?,?,?) ", Array As Object ("COACALCO",cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario))
|
||||
'para insertar la promo de ades el de regalo en 0
|
||||
e=skmt.ExecQuery("select count(*) as CUANTOS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) and CAT_DP_TIPO = 0 AND CAT_DP_PRECIO = 0")
|
||||
e.Position =0
|
||||
If e.GetString("CUANTOS") > 0 Then
|
||||
F=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) and CAT_DP_TIPO = 0 AND CAT_DP_PRECIO = 0")
|
||||
F.Position =0
|
||||
h=skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(f.GetString("CAT_DP_IDPROD")))
|
||||
h.Position=0
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, f.GetString("CAT_DP_PZAS") * cantidad.text, h.GetString("CAT_GP_NOMBRE"), f.GetString("CAT_DP_IDPROD"),clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
h.Close
|
||||
f.Close
|
||||
End If
|
||||
e.Close
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
Else
|
||||
Msgbox("Tiene " & TOT_ART_PROMO & " " & TOT_ART_PROMOR & " y necesita " & PROMO_C & " " & PROMO_CR & " Para la Promo. " , "ADVERTENCIA")
|
||||
End If
|
||||
End If
|
||||
|
||||
cantidad.Text = ""
|
||||
StartActivity(fila)
|
||||
else If l_marca.text = "PROMOS" And l_tipo.Text ="PROMOS" And PROMO_C = 0 Then
|
||||
skmt.ExecNonQuery("delete from PROIDID")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PROIDID VALUES (?)", Array As Object(L_PROID.text))
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
|
||||
c.Close
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
'skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO) VALUES(?,?,?,?,?,?,?,?,?) ", Array As Object ("COACALCO",cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario))
|
||||
'para insertar la promo de ades el de regalo en 0
|
||||
e=skmt.ExecQuery("select count(*) as CUANTOS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID) ")
|
||||
e.Position =0
|
||||
If e.GetString("CUANTOS") > 0 Then
|
||||
F=skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)")
|
||||
For i =0 To f.RowCount -1
|
||||
F.Position =i
|
||||
h=skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(f.GetString("CAT_DP_IDPROD")))
|
||||
h.Position=0
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,f.GetString("CAT_DP_PRECIO") * cantidad.text * f.GetString("CAT_DP_PZAS"), f.GetString("CAT_DP_PRECIO"), f.GetString("CAT_DP_PZAS") * cantidad.text, h.GetString("CAT_GP_NOMBRE"), f.GetString("CAT_DP_IDPROD"),clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
h.Close
|
||||
Next
|
||||
f.Close
|
||||
End If
|
||||
e.Close
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA) VALUES(?,?,?,?,?,?,?,?,?,?) ", Array As Object (L_PROID.text,0, 0, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
cantidad.Text = ""
|
||||
c=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
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"), lon_gps, lat_gps,ALMACEN,cl_ruta,c.GetString("TOTAL_CLIE_SIN")))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
|
||||
StartActivity(fila)
|
||||
|
||||
Else
|
||||
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c.Close
|
||||
c=skmt.ExecQuery("select CAT_CL_RUTA from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
c.Position=0
|
||||
cl_ruta = c.GetString("CAT_CL_RUTA")
|
||||
c.Close
|
||||
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN) VALUES(?,?,?,?,?,?,?,?,?,?,?) ", Array As Object (ALMACEN,cantidad.Text * l_precio.Text, l_precio.text, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario,cl_ruta,preciosin))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
c=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
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"), lon_gps, lat_gps,ALMACEN,cl_ruta,c.GetString("TOTAL_CLIE_SIN")))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
StartActivity(fila)
|
||||
End If
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
'StartActivity(colonia2)
|
||||
Msgbox("Presione Boton Terminar.","ADVERTENCIA")
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Sub img_prod_Click
|
||||
i_fotol.Visible = True
|
||||
i_fotol.Bitmap = LoadBitmap(ruta,"1.jpg")
|
||||
|
||||
End Sub
|
||||
Sub i_fotol_Click
|
||||
i_fotol.Visible = False
|
||||
|
||||
End Sub
|
||||
|
||||
Sub DESC_PROMO_Click
|
||||
skmt.ExecNonQuery("delete from PROIDID")
|
||||
skmt.ExecNonQuery2("INSERT INTO PROIDID VALUES (?)", Array As Object(L_PROID.text))
|
||||
|
||||
StartActivity(detalle_promo)
|
||||
End Sub
|
||||
Sub nopromo_Click
|
||||
If cantidad.Text = "" Then
|
||||
Msgbox("Cantidad no puede ser 0","Cantidad")
|
||||
Else If cantidad.Text > l_bodega.Text Then
|
||||
Msgbox("Exede la existencia", "ADVERTENCIA")
|
||||
Else
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO) VALUES(?,?,?,?,?,?,?,?,?) ", Array As Object ("COACALCO",0,0, cantidad.text, l_desc.text, L_PROID.Text,clie_id, sDate & sTime, usuario))
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object(cantidad.Text, L_PROID.Text))
|
||||
|
||||
|
||||
cantidad.Text = ""
|
||||
StartActivity(colonia2)
|
||||
|
||||
End If
|
||||
End Sub
|
||||
35
primero.bas
Normal file
@@ -0,0 +1,35 @@
|
||||
Type=Activity
|
||||
Version=3
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
Msgbox("Welcome to Basic4android!", "")
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
38
reparto.b4a.meta
Normal file
@@ -0,0 +1,38 @@
|
||||
VisibleModules=1,2,3,4,5,6,7,8
|
||||
ModuleBreakpoints0=
|
||||
ModuleClosedNodes0=10
|
||||
ModuleBreakpoints1=
|
||||
ModuleClosedNodes1=1,2,3,5,6,7,8,9,10,11,12,13,14,16,17,18
|
||||
ModuleBreakpoints2=
|
||||
ModuleClosedNodes2=
|
||||
ModuleBreakpoints3=
|
||||
ModuleClosedNodes3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleClosedNodes4=
|
||||
ModuleBreakpoints5=
|
||||
ModuleClosedNodes5=2,3,4,5
|
||||
ModuleBreakpoints6=
|
||||
ModuleClosedNodes6=
|
||||
ModuleBreakpoints7=
|
||||
ModuleClosedNodes7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleClosedNodes8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes9=
|
||||
ModuleBreakpoints10=
|
||||
ModuleClosedNodes10=
|
||||
ModuleBreakpoints11=
|
||||
ModuleClosedNodes11=
|
||||
ModuleBreakpoints12=
|
||||
ModuleClosedNodes12=
|
||||
ModuleBreakpoints13=
|
||||
ModuleClosedNodes13=
|
||||
ModuleBreakpoints14=
|
||||
ModuleClosedNodes14=
|
||||
ModuleBreakpoints15=
|
||||
ModuleClosedNodes15=
|
||||
ModuleBreakpoints16=
|
||||
ModuleClosedNodes16=
|
||||
ModuleBreakpoints17=
|
||||
ModuleClosedNodes17=
|
||||
SelectedBuild=0
|
||||
1224
seleccion.bas
Normal file
225
tarjeta.bas
Normal file
@@ -0,0 +1,225 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim skmt As SQL
|
||||
Dim g As GPS
|
||||
Dim clie_id As String
|
||||
Dim sDate,sTime As String
|
||||
Dim usuario As String
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
Dim Regresar As Button
|
||||
|
||||
|
||||
Dim ListView1 As ListView
|
||||
Dim L_CANT As Label
|
||||
Dim L_TOTAL As Label
|
||||
Dim borra As Button
|
||||
Dim Existe As String
|
||||
Dim result As String
|
||||
Dim lat_gps, lon_gps As String
|
||||
|
||||
|
||||
Private Titulo As Label
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
If(FirstTime) Then
|
||||
g.Initialize("GPS")
|
||||
End If
|
||||
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
Activity.LoadLayout("tarjeta")
|
||||
borra.Visible = True
|
||||
Titulo.Text = "Pedido Actual"
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select count(*) as EXISTE from pedido_cliente WHERE pc_cliente IN (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_CANT FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
ListView1.AddTwoLines(c.GetString("PE_PRONOMBRE"),"Cantidad #"& c.GetString("PE_CANT")& " SubTotal $"& c.GetString("PE_COSTO_TOT"))
|
||||
Next
|
||||
End If
|
||||
If Existe <> 0 Then
|
||||
c=skmt.ExecQuery("select pc_noart, pc_monto from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia"))
|
||||
' Next
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
If g.GPSEnabled=False Then
|
||||
ToastMessageShow("Habilitar el GPS", True)
|
||||
StartActivity(g.LocationSettingsIntent)
|
||||
Else
|
||||
g.Start(0,0)
|
||||
End If
|
||||
|
||||
L_CANT.Text =""
|
||||
L_TOTAL.Text=""
|
||||
c=skmt.ExecQuery("select count(*) as EXISTE from pedido_cliente WHERE pc_cliente IN (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
Existe = C.GetString("EXISTE")
|
||||
C.Close
|
||||
c=skmt.ExecQuery("select PE_PRONOMBRE,PE_COSTO_TOT, PE_CANT FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
ListView1.Clear
|
||||
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
Dim label1 As Label
|
||||
label1 = ListView1.TwoLinesLayout.Label
|
||||
label1.TextSize = 10
|
||||
label1.TextColor = Colors.Black
|
||||
Dim label2 As Label
|
||||
label2 = ListView1.TwoLinesLayout.SecondLabel
|
||||
label2.TextSize = 10
|
||||
label2.TextColor = Colors.Blue
|
||||
ListView1.AddTwoLines(c.GetString("PE_PRONOMBRE"),"Cantidad #"& c.GetString("PE_CANT")& " SubTotal $"& c.GetString("PE_COSTO_TOT"))
|
||||
Next
|
||||
End If
|
||||
If Existe <> 0 Then
|
||||
c=skmt.ExecQuery("select pc_noart, pc_monto from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
C.Position=0
|
||||
L_CANT.Text = c.GetString("PC_NOART")
|
||||
L_TOTAL.Text = c.GetString("PC_MONTO")
|
||||
End If
|
||||
'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT")
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
lat_gps=Location1.ConvertToSeconds(Location1.Latitude)
|
||||
lon_gps=Location1.ConvertToSeconds(Location1.Longitude)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Regresar_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Sub borra_Click
|
||||
result = Msgbox2("Seguro que desa borrar el pedido?","Cancelar pedido", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png"))
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
|
||||
c=skmt.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID")))
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
skmt.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Sub ListView1_ItemLongClick (Position As Int, Value As Object)
|
||||
result = Msgbox2("Seguro que desa borrar este articulo?","Borrar Articulo", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png"))
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
c=skmt.ExecQuery2("select PE_PROID,PE_CANT FROM PEDIDO where pe_pronombre = ? and pe_cliente in (Select CUENTA from cuentaa) ", Array As String(Value))
|
||||
c.Position=0
|
||||
skmt.ExecNonQuery2("update cat_gunaprod set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?", Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID")))
|
||||
c.Close
|
||||
c=skmt.ExecQuery2("select count(*) AS CUANTOS from cat_gunaprod where CAT_GP_ID in (select pe_cedis from pedido where pe_pronombre = ? and pe_cliente in (Select CUENTA from cuentaa)) and CAT_GP_CLASIF = 'PROMOS' AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS'", Array As String(Value))
|
||||
c.Position=0
|
||||
If c.GetString("CUANTOS") > 0 Then
|
||||
skmt.ExecNonQuery2("delete from pedido where pe_cedis in (select pe_cedis from pedido where pe_pronombre = ?) and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(Value))
|
||||
Else
|
||||
skmt.ExecNonQuery2("delete from pedido where pe_pronombre = ? and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(Value))
|
||||
End If
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
|
||||
c=skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, count(*) as CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
If c.GetString("CUANTOS") > 0 Then
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
skmt.ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT) VALUES (?,?,?,?,?,?,?)", Array As Object(clie_id, sDate & sTime, usuario, c.GetString("CANT_CLIE"),c.GetString("TOTAL_CLIE"), lon_gps, lat_gps))
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Else
|
||||
skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
End If
|
||||
Activity_Resume
|
||||
|
||||
End If
|
||||
End Sub
|
||||
132
telefonos.bas
Normal file
@@ -0,0 +1,132 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=6.8
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Dim skmt As SQL
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
Dim c As Cursor
|
||||
Dim ruta As String
|
||||
|
||||
Dim Regresa As Button
|
||||
|
||||
Dim Agrega As Button
|
||||
Dim e_atiende1 As EditText
|
||||
Dim e_atiende2 As EditText
|
||||
Dim e_tel As EditText
|
||||
Dim e_email As EditText
|
||||
Dim e_edo As EditText
|
||||
Dim e_mpo As EditText
|
||||
Dim e_cp As EditText
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
'Activity.LoadLayout("Layout1")
|
||||
If File.ExternalWritable Then
|
||||
ruta = File.DirDefaultExternal
|
||||
Else
|
||||
ruta = File.DirInternal
|
||||
End If
|
||||
Activity.LoadLayout("telefonos")
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
|
||||
End If
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
e_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
If e_edo.Text <> "" Or e_edo.text <> "null" Then
|
||||
e_edo.Enabled = False
|
||||
End If
|
||||
e_cp.Text = c.GetString("CAT_CL_CP")
|
||||
If e_cp.Text <> "" Then
|
||||
e_cp.Enabled = False
|
||||
End If
|
||||
e_mpo.Text = c.GetString("CAT_CL_MUNI")
|
||||
If e_mpo.Text <> "" Then
|
||||
e_mpo.Enabled = False
|
||||
End If
|
||||
e_email.Text = c.GetString("CAT_CL_EMAIL")
|
||||
e_tel.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
e_atiende1.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
e_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
|
||||
' se crea o no el archivo de la base de ddatos de kmt
|
||||
'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE
|
||||
'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA
|
||||
'SI SE REGRESA A ESTE ACTIVIDAD.
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
skmt.Initialize(ruta,"kmt.db", True)
|
||||
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT from kmt_info where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
||||
' ListView1.Clear
|
||||
|
||||
'If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
c.Position=0
|
||||
e_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
If e_edo.Text <> "" Or e_edo.text <> "null" Then
|
||||
e_edo.Enabled = False
|
||||
End If
|
||||
e_cp.Text = c.GetString("CAT_CL_CP")
|
||||
If e_cp.Text <> "" Then
|
||||
e_cp.Enabled = False
|
||||
End If
|
||||
e_mpo.Text = c.GetString("CAT_CL_MUNI")
|
||||
If e_mpo.Text <> "" Then
|
||||
e_mpo.Enabled = False
|
||||
End If
|
||||
e_email.Text = c.GetString("CAT_CL_EMAIL")
|
||||
e_tel.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
e_atiende1.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
e_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub Regresa_Click
|
||||
StartActivity(fila)
|
||||
End Sub
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
StartActivity(seleccion)
|
||||
'Return True
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
Return False
|
||||
End Sub
|
||||
Sub Agrega_Click
|
||||
c=skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
C.Position =0
|
||||
skmt.ExecNonQuery2("insert into CLIE_ACT(CLIENTE,ATIENDE1, ATIENDE2,TEL,EMAIL,EDO,CP, MPO) VALUES (?,?,?,?,?,?,?,?)", Array As Object(c.GetString("CUENTA"),e_atiende1.Text ,e_atiende2.Text,e_tel.text,e_email.Text,e_edo.Text,e_cp.Text,e_mpo.Text))
|
||||
c.Close
|
||||
StartActivity(seleccion)
|
||||
End Sub
|
||||