-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmComPtrans.frm
1732 lines (1380 loc) · 58.9 KB
/
frmComPtrans.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
VERSION 5.00
Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
Begin VB.Form frmComPtrans
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Comprobar Transferencia"
ClientHeight = 7650
ClientLeft = 45
ClientTop = 405
ClientWidth = 11910
ControlBox = 0 'False
BeginProperty Font
Name = "Trebuchet MS"
Size = 11.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 7650
ScaleWidth = 11910
StartUpPosition = 2 'CenterScreen
Begin PCGestion.miText ioCODBAR
Height = 495
Left = 1275
TabIndex = 0
Top = 60
Width = 2595
_extentx = 4577
_extenty = 873
font = "frmComPtrans.frx":0000
dspformat = ""
enabled = -1 'True
espassword = -1 'True
End
Begin VSFlex8Ctl.VSFlexGrid fg
Height = 6300
Left = 30
TabIndex = 2
TabStop = 0 'False
Top = 975
Width = 5610
_cx = 9895
_cy = 11112
Appearance = 1
BorderStyle = 1
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Trebuchet MS"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MousePointer = 0
BackColor = -2147483643
ForeColor = -2147483640
BackColorFixed = -2147483633
ForeColorFixed = -2147483630
BackColorSel = -2147483635
ForeColorSel = -2147483634
BackColorBkg = -2147483636
BackColorAlternate= -2147483643
GridColor = -2147483633
GridColorFixed = -2147483632
TreeColor = -2147483632
FloodColor = 192
SheetBorder = -2147483642
FocusRect = 1
HighLight = 1
AllowSelection = -1 'True
AllowBigSelection= -1 'True
AllowUserResizing= 0
SelectionMode = 0
GridLines = 1
GridLinesFixed = 2
GridLineWidth = 1
Rows = 50
Cols = 5
FixedRows = 1
FixedCols = 1
RowHeightMin = 0
RowHeightMax = 0
ColWidthMin = 0
ColWidthMax = 0
ExtendLastCol = 0 'False
FormatString = $"frmComPtrans.frx":002C
ScrollTrack = 0 'False
ScrollBars = 3
ScrollTips = 0 'False
MergeCells = 0
MergeCompare = 0
AutoResize = -1 'True
AutoSizeMode = 0
AutoSearch = 0
AutoSearchDelay = 2
MultiTotals = -1 'True
SubtotalPosition= 1
OutlineBar = 0
OutlineCol = 0
Ellipsis = 0
ExplorerBar = 0
PicturesOver = 0 'False
FillStyle = 0
RightToLeft = 0 'False
PictureType = 0
TabBehavior = 0
OwnerDraw = 0
Editable = 0
ShowComboButton = 1
WordWrap = 0 'False
TextStyle = 0
TextStyleFixed = 0
OleDragMode = 0
OleDropMode = 0
DataMode = 0
VirtualData = -1 'True
DataMember = ""
ComboSearch = 3
AutoSizeMouse = -1 'True
FrozenRows = 0
FrozenCols = 0
AllowUserFreezing= 0
BackColorFrozen = 0
ForeColorFrozen = 0
WallPaperAlignment= 9
AccessibleName = ""
AccessibleDescription= ""
AccessibleValue = ""
AccessibleRole = 24
End
Begin VSFlex8Ctl.VSFlexGrid fgDif
Height = 6300
Left = 5640
TabIndex = 3
TabStop = 0 'False
Top = 975
Width = 6270
_cx = 11060
_cy = 11112
Appearance = 1
BorderStyle = 1
Enabled = -1 'True
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Trebuchet MS"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MousePointer = 0
BackColor = -2147483643
ForeColor = -2147483640
BackColorFixed = -2147483633
ForeColorFixed = -2147483630
BackColorSel = -2147483635
ForeColorSel = -2147483634
BackColorBkg = -2147483636
BackColorAlternate= -2147483643
GridColor = -2147483633
GridColorFixed = -2147483632
TreeColor = -2147483632
FloodColor = 192
SheetBorder = -2147483642
FocusRect = 1
HighLight = 1
AllowSelection = -1 'True
AllowBigSelection= -1 'True
AllowUserResizing= 0
SelectionMode = 0
GridLines = 1
GridLinesFixed = 2
GridLineWidth = 1
Rows = 50
Cols = 5
FixedRows = 1
FixedCols = 1
RowHeightMin = 0
RowHeightMax = 0
ColWidthMin = 0
ColWidthMax = 0
ExtendLastCol = 0 'False
FormatString = $"frmComPtrans.frx":00CF
ScrollTrack = 0 'False
ScrollBars = 3
ScrollTips = 0 'False
MergeCells = 0
MergeCompare = 0
AutoResize = -1 'True
AutoSizeMode = 0
AutoSearch = 0
AutoSearchDelay = 2
MultiTotals = -1 'True
SubtotalPosition= 1
OutlineBar = 0
OutlineCol = 0
Ellipsis = 0
ExplorerBar = 0
PicturesOver = 0 'False
FillStyle = 0
RightToLeft = 0 'False
PictureType = 0
TabBehavior = 0
OwnerDraw = 0
Editable = 0
ShowComboButton = 1
WordWrap = 0 'False
TextStyle = 0
TextStyleFixed = 0
OleDragMode = 0
OleDropMode = 0
DataMode = 0
VirtualData = -1 'True
DataMember = ""
ComboSearch = 3
AutoSizeMouse = -1 'True
FrozenRows = 0
FrozenCols = 0
AllowUserFreezing= 0
BackColorFrozen = 0
ForeColorFrozen = 0
WallPaperAlignment= 9
AccessibleName = ""
AccessibleDescription= ""
AccessibleValue = ""
AccessibleRole = 24
End
Begin PCGestion.bsGradientLabel lblstatus
Height = 315
Left = 45
Top = 7305
Width = 12405
_extentx = 10081
_extenty = 556
caption = ""
fount = "frmComPtrans.frx":0172
captioncolour = 0
colour1 = 15640462
colour2 = 7177785
captionalignment= 1
End
Begin PCGestion.chameleonButton cmdAceptarTrans
Height = 615
Left = 10245
TabIndex = 4
Top = 15
Width = 1650
_extentx = 2910
_extenty = 1085
btype = 3
tx = "Introducir c鏚igo de seguridad"
enab = -1 'True
font = "frmComPtrans.frx":01A0
coltype = 1
focusr = -1 'True
bcol = 11513775
bcolo = 11513775
fcol = 16776960
fcolo = 16776960
mcol = 12632256
mptr = 1
micon = "frmComPtrans.frx":01CC
umcol = -1 'True
soft = 0 'False
picpos = 0
ngrey = 0 'False
fx = 0
hand = 0 'False
check = 0 'False
value = 0 'False
End
Begin PCGestion.bsGradientLabel bsGradientLabel1
Height = 315
Left = 3885
Top = 0
Width = 2685
_extentx = 4736
_extenty = 556
caption = "- B - Borrar ultimo art獳ulo"
fount = "frmComPtrans.frx":01EA
captioncolour = 0
colour1 = 16761024
colour2 = 16744576
End
Begin PCGestion.bsGradientLabel bsGradientLabel2
Height = 315
Left = 30
Top = 645
Width = 5610
_extentx = 9895
_extenty = 556
caption = "Introducido"
fount = "frmComPtrans.frx":0218
captioncolour = 0
colour1 = 16761024
colour2 = 16744576
captionalignment= 1
End
Begin PCGestion.bsGradientLabel bsGradientLabel3
Height = 315
Left = 3885
Top = 315
Width = 2685
_extentx = 4736
_extenty = 556
caption = "- A - Aceptar Transferencia"
fount = "frmComPtrans.frx":0246
captioncolour = 0
colour1 = 16761024
colour2 = 16744576
End
Begin PCGestion.bsGradientLabel bsGradientLabel4
Height = 330
Left = 5670
Top = 645
Width = 6225
_extentx = 10980
_extenty = 582
caption = "Diferencias"
fount = "frmComPtrans.frx":0274
captioncolour = 0
colour1 = 16761024
colour2 = 16744576
captionalignment= 1
End
Begin PCGestion.bsGradientLabel bsGradientLabel5
Height = 315
Left = 6600
Top = 315
Width = 1050
_extentx = 1852
_extenty = 556
caption = "- S - Salir"
fount = "frmComPtrans.frx":02A2
captioncolour = 0
colour1 = 16761024
colour2 = 16744576
End
Begin PCGestion.bsGradientLabel lblSobran
Height = 315
Left = 8490
Top = -15
Width = 1725
_extentx = 3043
_extenty = 556
caption = ""
fount = "frmComPtrans.frx":02D0
captioncolour = 0
colour1 = 11311500
colour2 = 16558731
End
Begin PCGestion.bsGradientLabel lblFaltan
Height = 315
Left = 8490
Top = 315
Width = 1725
_extentx = 3043
_extenty = 556
caption = ""
fount = "frmComPtrans.frx":02FE
captioncolour = 0
colour1 = 11311500
colour2 = 16558731
End
Begin PCGestion.chameleonButton cbImprimir
Height = 615
Left = 7680
TabIndex = 5
TabStop = 0 'False
Top = 15
Width = 780
_extentx = 1376
_extenty = 1085
btype = 9
tx = ""
enab = -1 'True
font = "frmComPtrans.frx":032C
coltype = 1
focusr = -1 'True
bcol = 11513775
bcolo = 11513775
fcol = 0
fcolo = 0
mcol = 12632256
mptr = 1
micon = "frmComPtrans.frx":0358
picn = "frmComPtrans.frx":0376
umcol = -1 'True
soft = 0 'False
picpos = 2
ngrey = 0 'False
fx = 1
hand = 0 'False
check = 0 'False
value = 0 'False
End
Begin PCGestion.chameleonButton cbRepetir
Height = 300
Left = 6570
TabIndex = 6
Top = 15
Width = 1095
_extentx = 1931
_extenty = 529
btype = 3
tx = "Repetir"
enab = -1 'True
font = "frmComPtrans.frx":1052
coltype = 1
focusr = -1 'True
bcol = 11513775
bcolo = 11513775
fcol = 16776960
fcolo = 16776960
mcol = 12632256
mptr = 1
micon = "frmComPtrans.frx":107E
umcol = -1 'True
soft = 0 'False
picpos = 0
ngrey = 0 'False
fx = 0
hand = 0 'False
check = 0 'False
value = 0 'False
End
Begin VB.Label Label17
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "CODIGO DE BARRAS"
Height = 585
Left = -15
TabIndex = 1
Top = 15
Width = 1245
End
End
Attribute VB_Name = "frmComPtrans"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'---------------------------------------------------------------------------------------
' Modulo : frmComPtrans
' Fecha/Hora : 11/01/2004 17:28
' Autor : JCASTILLO
' Prop鏀ito : Comprobar transferencia. Al aceptar la transferencia se debe comprobar
' con la mercanc燰. Para ello se introducen todos los codigos de barras de la
' mercanc燰
'---------------------------------------------------------------------------------------
Option Explicit
'para localizar la transferencia
Public ID_TRANSF As Long
Public ALM_TRANSF As Byte
Dim tmpCnn As New ADODB.Connection
Dim rc As New ADODB.Recordset
Dim rcDif As New ADODB.Recordset
Dim rcRec As New ADODB.Recordset
'para controlar que no se compruebe mas de una vez para la misma transferencia
Dim Comprobada As Boolean
'si ultimo_ok = true es que el ultimo codigo pertenece correctamente a la
'transferencia, Para cuando el usuario pulse B, saber en que tabla se ha
'Estados de la comprobaci鏮
'0 -> no se ha pasado
'1 -> correcta, todos los articulos OK.
'2 -> incorrecta (faltan o sobran)
Public estado As Byte
Dim filas As Long
Dim filasdif As Long
Const path_tmp = "C:\TRANSFERENCIAS\COMPTRN\"
Dim fichero As String
'Const fichero = path_tmp & "C:\TmpCmpPtrn.mdb"
Dim sCnn As String
Dim repetir As Integer
'---------------------------------------------------------------------------------------
' Procedimiento : cbImprimir_Click
' Fecha/Hora : 04/02/2004 11:12
' Autor : JCastillo
' Prop鏀ito : Imprimir las diferencias con la transferencia actual.
'---------------------------------------------------------------------------------------
'
Private Sub cbImprimir_Click()
Dim linea1 As String
Dim linea2 As String
On Error GoTo cbImprimir_Click_Error
DoEvents
linea1 = "Diferencias de con Transferencia. Codigo: " & Me.ID_TRANSF & ". Origen: " & Trim(devuelve_campo("SELECT DESCRIPCION FROM ALMACENES WHERE CODIGO = " & Me.ALM_TRANSF, locCnn)) & ". Destino: " & Trim(devuelve_campo("select descripcion from almacenes where codigo = " & AlmacenActual, locCnn))
linea2 = lblFaltan.Caption & " . " & lblSobran.Caption & ". Usuario: " & Trim(devuelve_campo("SELECT NOMBRE FROM PERSONAL WHERE CODIGO = " & UsuarioActual, locCnn)) & ". Fecha: " & Now
Call PrintFlexGrid(fgDif, 1, 1, 1, linea1, linea2, 10, 2)
On Error GoTo 0
Exit Sub
cbImprimir_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento cbImprimir_Click de Formulario frmComPtrans"
End Sub
'---------------------------------------------------------------------------------------
' Subrutina : comprobar_codigo_trn
' Fecha/Hora : 11/01/2004 17:31
' Autor : JCASTILLO
' Prop鏀ito : Comprueba que el codigo exista en la transferencia
' TRUE -> CORRECTO
' FALSE-> INCORRECTO
'---------------------------------------------------------------------------------------
Private Function comprobar_codigo_trn(codigo As String) As Boolean
Dim Codigo_B As MiCodBar
Dim tmpcodcolor As Variant
Dim tmpcodprov As Variant
Dim i As Integer
On Error GoTo comprobar_codigo_trn_Error
Codigo_B = Descompone_CBAR(codigo)
'primero comprobar que exista el art獳ulo en la base de datos ...
If devuelve_campo("Select CODIGO FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn) = "@" Then
lblstatus.Caption = "C鏚igo no v嫮ido. No existe en la base de datos."
comprobar_codigo_trn = False
Exit Function
End If
'luego si existe el art獳ulo en esa transferencia ...
If devuelve_campo("Select CODART from tmp_DETTRANS where CODART = " & CLng(Codigo_B.CODIGO_ART) & _
" AND TEMPOR = " & CLng(Codigo_B.TEMPORADA_ART) & " AND CODTALLA = " & CLng(Codigo_B.TALLA_ART) & " AND CODCOL = " & CLng(Codigo_B.COLOR_ART), tmpCnn) <> "@" Then
'articulo no existe en la transferencia.
tmpcodprov = devuelve_campo("SELECT CODPROV FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn)
If repetir <= 0 Then
'articulo OK, existe.
fg.AddItem "", 2
fg.TextMatrix(2, 1) = Trim(devuelve_campo("SELECT NOMBRE FROM MAPROV WHERE CODIGO = " & tmpcodprov, locCnn))
fg.TextMatrix(2, 2) = Trim(devuelve_campo("SELECT REF FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn))
fg.TextMatrix(2, 3) = Codigo_B.CODIGO_ART & " " & devuelve_campo("SELECT MODELO FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn)
fg.TextMatrix(2, 4) = Codigo_B.TEMPORADA_ART & " " & devuelve_campo("SELECT ABREVIA FROM TEMPOR WHERE IDTEM = " & Codigo_B.TEMPORADA_ART, locCnn)
fg.TextMatrix(2, 5) = devuelve_campo("SELECT DESCRIPCION FROM TALLAS WHERE CODIGO = " & Codigo_B.TALLA_ART, locCnn)
fg.TextMatrix(2, 6) = devuelve_campo("SELECT DESCRIPCION FROM COLORES WHERE CODIGO = " & Codigo_B.COLOR_ART, locCnn)
tmpcodcolor = devuelve_campo("SELECT CODCOL FROM COLORES WHERE CODIGO = " & Codigo_B.COLOR_ART, locCnn)
fg.Row = 2
fg.Col = 6
fg.CellBackColor = tmpcodcolor
fg.Col = 3
fg.AutoSize 1, fg.Cols - 1
fg.subtotal flexSTCount, , 6, , vbBlue, vbWhite
fg.TextMatrix(1, 5) = "Total"
fg.TextMatrix(1, 1) = ""
' filas = filas + 1
'a鎙dir registro de recibido
With rcRec
.AddNew
.fields("CODART") = CDbl(Codigo_B.CODIGO_ART)
.fields("CODCOL") = CLng(Codigo_B.COLOR_ART)
.fields("CODTALLA") = CLng(Codigo_B.TALLA_ART)
.fields("TEMPOR") = CLng(Codigo_B.TEMPORADA_ART)
.Update
End With
Else
For i = 1 To repetir
'articulo OK, existe.
fg.AddItem "", 2
fg.TextMatrix(2, 1) = Trim(devuelve_campo("SELECT NOMBRE FROM MAPROV WHERE CODIGO = " & tmpcodprov, locCnn))
fg.TextMatrix(2, 2) = Trim(devuelve_campo("SELECT REF FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn))
fg.TextMatrix(2, 3) = Codigo_B.CODIGO_ART & " " & devuelve_campo("SELECT MODELO FROM MAARTIC WHERE CODIGO = " & Codigo_B.CODIGO_ART & " AND TEMPOR = " & Codigo_B.TEMPORADA_ART, locCnn)
fg.TextMatrix(2, 4) = Codigo_B.TEMPORADA_ART & " " & devuelve_campo("SELECT ABREVIA FROM TEMPOR WHERE IDTEM = " & Codigo_B.TEMPORADA_ART, locCnn)
fg.TextMatrix(2, 5) = devuelve_campo("SELECT DESCRIPCION FROM TALLAS WHERE CODIGO = " & Codigo_B.TALLA_ART, locCnn)
fg.TextMatrix(2, 6) = devuelve_campo("SELECT DESCRIPCION FROM COLORES WHERE CODIGO = " & Codigo_B.COLOR_ART, locCnn)
tmpcodcolor = devuelve_campo("SELECT CODCOL FROM COLORES WHERE CODIGO = " & Codigo_B.COLOR_ART, locCnn)
fg.Row = 2
fg.Col = 6
fg.CellBackColor = tmpcodcolor
fg.Col = 3
fg.AutoSize 1, fg.Cols - 1
fg.subtotal flexSTCount, , 6, , vbBlue, vbWhite
fg.TextMatrix(1, 5) = "Total"
fg.TextMatrix(1, 1) = ""
With rcRec
.AddNew
.fields("CODART") = CDbl(Codigo_B.CODIGO_ART)
.fields("CODCOL") = CLng(Codigo_B.COLOR_ART)
.fields("CODTALLA") = CLng(Codigo_B.TALLA_ART)
.fields("TEMPOR") = CLng(Codigo_B.TEMPORADA_ART)
.Update
End With
Next i
repetir = 0
End If
DoEvents
'fg.Rows = fg.Rows + 1
comprobar_codigo_trn = True
Else
'a鎙de registro de diferencias y en el grid
Call a鎙de_diferencia(CLng(Codigo_B.CODIGO_ART), CByte(Codigo_B.TEMPORADA_ART), CInt(Codigo_B.TALLA_ART), CInt(Codigo_B.COLOR_ART), 1, 1)
comprobar_codigo_trn = False
End If
Exit Function
comprobar_codigo_trn_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento comprobar_codigo_trn de Formulario frmComPtrans"
End Function
Private Sub a鎙de_diferencia(codart As Long, tempor As Byte, codtalla As Integer, codcol As Integer, uds As Single, causa As Byte)
Dim tmpcodcolor As Variant
Dim tmpcodprov As Variant
On Error GoTo a鎙de_diferencia_Error
'articulo no existe en la transferencia.
tmpcodprov = devuelve_campo("SELECT CODPROV FROM MAARTIC WHERE CODIGO = " & codart & " AND TEMPOR = " & tempor, locCnn)
With fgDif
.AddItem "", 2
.TextMatrix(2, 1) = Trim(devuelve_campo("SELECT NOMBRE FROM MAPROV WHERE CODIGO = " & tmpcodprov, locCnn))
.TextMatrix(2, 2) = Trim(devuelve_campo("SELECT REF FROM MAARTIC WHERE CODIGO = " & codart & " AND TEMPOR = " & tempor, locCnn))
.TextMatrix(2, 3) = Format(codart, "00000") & " " & devuelve_campo("SELECT MODELO FROM MAARTIC WHERE CODIGO = " & codart & " AND TEMPOR = " & tempor, locCnn)
.TextMatrix(2, 4) = Format(tempor, "000") & " " & devuelve_campo("SELECT ABREVIA FROM TEMPOR WHERE IDTEM = " & tempor, locCnn)
.TextMatrix(2, 5) = devuelve_campo("SELECT DESCRIPCION FROM TALLAS WHERE CODIGO = " & codtalla, locCnn)
.TextMatrix(2, 6) = devuelve_campo("SELECT DESCRIPCION FROM COLORES WHERE CODIGO = " & codcol, locCnn)
.TextMatrix(2, 7) = uds
If causa = 1 Then
.TextMatrix(2, 8) = "SOBRA"
Else
.TextMatrix(2, 8) = "FALTA"
End If
tmpcodcolor = devuelve_campo("SELECT CODCOL FROM COLORES WHERE CODIGO = " & codcol, locCnn)
If tmpcodcolor <> "@" Then
.Row = 2
.Col = 6
.CellBackColor = tmpcodcolor
.Col = 3
End If
'.SubtotalPosition = flexSTBelow
.subtotal flexSTCount, , 5, , vbBlue, vbWhite
.subtotal flexSTSum, , 7, , vbBlue, vbWhite
.TextMatrix(1, 1) = ""
.TextMatrix(1, 4) = "Total"
.TextMatrix(1, 6) = "Uds:"
.AutoSize 1, .Cols - 1
End With
With rcDif
.AddNew
.fields("CODART") = codart
.fields("CODCOL") = codcol
.fields("CODTALLA") = codtalla
.fields("TEMPOR") = tempor
.fields("UNIDADES") = uds
.fields("CAUSA") = causa
.Update
End With
On Error GoTo 0
Exit Sub
a鎙de_diferencia_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento a鎙de_diferencia de Formulario frmComPtrans"
End Sub
'---------------------------------------------------------------------------------------
' Subrutina : cbRepetir_Click
' Fecha/Hora : 13/10/2004 19:10
' Autor : JCASTILLO
' Prop鏀ito :
'
'---------------------------------------------------------------------------------------
Private Sub cbRepetir_Click()
Dim srepetir As String
On Error GoTo cbRepetir_Click_Error
Do
srepetir = InputBox("Repetir la siguiente prenda N� veces", "Nero de veces a repetir", 1)
Loop Until Trim(srepetir) <> "" And IsNumeric(Trim(srepetir))
repetir = CLng(srepetir)
On Error GoTo 0
Exit Sub
cbRepetir_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento cbRepetir_Click de Formulario frmComPtrans"
End Sub
'---------------------------------------------------------------------------------------
' Subrutina : cmdAceptarTrans_Click
' Fecha/Hora : 14/01/2004 21:20
' Autor : JCASTILLO
' Prop鏀ito : Intenta aceptar transferencia desde el codigo de seguridad
'---------------------------------------------------------------------------------------
Private Sub cmdAceptarTrans_Click()
Dim m As Double
Dim codusr As String
Dim tmpid As Variant
Dim rcmsg As New ADODB.Recordset
'On Error GoTo cmdAceptarTrans_Click_Error
codusr = InputBox("Introduzca C鏚igo de Seguridad para la Transferencia", "Introduzca Codigo")
If codusr = "" Or Not IsNumeric(codusr) Then Exit Sub
m = CodigoSeguridad_TRN(Format(ID_TRANSF, "000000000") & Format(ALM_TRANSF, "000"))
If codusr <> m Then
MsgBox "。鏚igo de Seguridad No V嫮ido!", vbExclamation, titulo
'estado = 2
Else
'que escriba todas las diferencias al fichero si no lo ha echo ya
If Not Comprobada Then Call comprueba_unidades
tmpid = devuelve_campo("SELECT MAX(ID) + 1 FROM PTRANSMSG WHERE CODALM = " & AlmacenActual, locCnn)
If tmpid = "@" Then tmpid = 1
With rcmsg
.Open "SELECT TOP 1 * FROM PTRANSMSG", locCnn, adOpenDynamic, adLockOptimistic
.AddNew
.fields("ID") = tmpid
.fields("CODIGO") = ID_TRANSF
.fields("CODALMORIG") = ALM_TRANSF
.fields("CODUSR") = UsuarioActual
.fields("CODALM") = AlmacenActual
.fields("MSG") = Generar_Informe
.Update
.Close
End With
'poner a true para q no deje meter mas art獳ulos despues de validar
Set rcmsg = Nothing
Comprobada = True
MsgBox "El c鏚igo se ha validado correctamente. Transferencia Aceptada", vbInformation, titulo
estado = 1 'poner a correcta
Unload Me 'descargar el formulario para continuar el proceso
End If
On Error GoTo 0
Exit Sub
cmdAceptarTrans_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento cmdAceptarTrans_Click de Formulario frmComPtrans"
End Sub
'---------------------------------------------------------------------------------------
' Subrutina : Generar_Informe
' Fecha/Hora : 14/01/2004 21:32
' Autor : JCASTILLO
' Prop鏀ito : Genera un informe con las diferencias que sera insertado en un mensaje
' relacionado con esta transferencia
'---------------------------------------------------------------------------------------
Private Function Generar_Informe() As String
Dim tmpinf As String
Dim tmpcabe As String
On Error GoTo Generar_Informe_Error
With rcDif
'si no hay nada, salir
' If .RecordCount <= 0 Then
' Generar_Informe = ""
' Exit Function
' End If
.MoveFirst
' .Sort = "CAUSA"
Do
tmpinf = tmpinf & "CB: [" & Format(.fields("CODART"), "00000") & Format(.fields("TEMPOR"), "000") & Format(.fields("CODTALLA"), "00") & Format(.fields("CODCOL"), "000") & "] "
tmpinf = tmpinf & Format(.fields("CODART"), "00000") & " " & devuelve_campo("SELECT MODELO FROM MAARTIC WHERE CODIGO = " & .fields("CODART") & " AND TEMPOR = " & .fields("TEMPOR"), locCnn)
tmpinf = tmpinf & " " & Format(.fields("TEMPOR"), "000") & " " & devuelve_campo("SELECT ABREVIA FROM TEMPOR WHERE IDTEM = " & .fields("TEMPOR"), locCnn)
tmpinf = tmpinf & "-" & devuelve_campo("SELECT DESCRIPCION FROM TALLAS WHERE CODIGO = " & .fields("CODTALLA"), locCnn)
tmpinf = tmpinf & "-" & devuelve_campo("SELECT DESCRIPCION FROM COLORES WHERE CODIGO = " & .fields("CODCOL"), locCnn)
tmpinf = tmpinf & "-Unidades: " & .fields("UNIDADES") & " "
Select Case .fields("CAUSA")
Case 1 'no existe en la transferencia (sobra)
tmpinf = tmpinf & " CAUSA: SOBRA"
Case 2 'falta articulo
tmpinf = tmpinf & " CAUSA: FALTA"
End Select
'nueva linea
tmpinf = tmpinf & vbCrLf
If Not .EOF Then .MoveNext
Loop Until .EOF
End With
tmpcabe = Format(Now, "dd/mm/yyyy") & " INFORME DE DIFERENCIAS: " & vbCrLf & vbCrLf & "Total Sobran: " & devuelve_campo("SELECT COUNT(CODART) from DIFERENCIAS where CAUSA = 1", tmpCnn) & vbCrLf & "Total Faltan: " & devuelve_campo("SELECT COUNT(CODART) from DIFERENCIAS where CAUSA = 2", tmpCnn)
Generar_Informe = tmpcabe & vbCrLf & tmpinf
tmpinf = ""
On Error GoTo 0
Exit Function
Generar_Informe_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") en procedimiento Generar_Informe de Formulario frmComPtrans"
End Function
'Private Sub cbAceptar_Click()
'Unload Me
'End Sub
'Private Sub cbCancelar_Click()
'Unload Me
'Set frmComPtrans = Nothing
'End Sub
Private Sub Form_Load()
With fg
.Cols = 7
.Rows = 2
.TextMatrix(filas, 1) = "PROV."
.TextMatrix(filas, 2) = "REF."
.TextMatrix(filas, 3) = "MODELO"
.TextMatrix(filas, 4) = "TEMP."
.TextMatrix(filas, 5) = "TALLA"
.TextMatrix(filas, 6) = "COLOR"
.subtotal flexSTCount, , 6, , vbBlue, vbWhite
.TextMatrix(1, 5) = "Total"
.TextMatrix(1, 1) = ""
.AutoSize 1, .Cols - 1
End With
With fgDif
.Cols = 9 'una columna mas, el motivo de la diferencia
.Rows = 2
.TextMatrix(filas, 1) = "PROV."
.TextMatrix(filas, 2) = "REF."
.TextMatrix(filas, 3) = "MODELO"
.TextMatrix(filas, 4) = "TEMP."
.TextMatrix(filas, 5) = "TALLA"
.TextMatrix(filas, 6) = "COLOR"
.TextMatrix(filas, 7) = "UDS."
.TextMatrix(filas, 8) = "CAUSA"
.subtotal flexSTCount, , 4, , vbBlue, vbWhite
.TextMatrix(1, 3) = "Total"
.TextMatrix(1, 1) = ""
.AutoSize 1, .Cols - 1
End With
'filas = 1
'filasdif = 1
'fg.Rows = fg.Rows + 1
With ioCODBAR
.LongMaxima = LenCodBar
.SoloNumeros = True
.PermitirBlanco = True
End With
fichero = "ComTRN-" & ID_TRANSF & "-" & ALM_TRANSF & ".ctran"
sCnn = strCnnMdb & path_tmp & fichero
'sCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=" & fichero
'crea la db temporal para guardar los datos
Call CreateDatabaseTemporal
'carga transferencia al fichero de trabajo
Call cargar_transferencia
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'descargar objetos
If rc.State = 1 Then
rc.Close
Set rc = Nothing
End If
If rcDif.State = 1 Then
rcDif.Close
Set rcDif = Nothing
End If
If rcRec.State = 1 Then
rcRec.Close
Set rcRec = Nothing
End If
If tmpCnn.State = 1 Then
tmpCnn.Close
Set tmpCnn = Nothing
End If
End Sub
Private Sub ioCODBAR_LostFocus()
On Error GoTo ioCODBAR_LostFocus_Error
With ioCODBAR
'si ya ha sido comprobada no dejar meter mas prendas
If Comprobada Then
.SetFocus
lblstatus.Caption = "La transferencia ya ha sido comprobada"
Exit Sub