Changed case/unit quantity storage in database to use strings instead of integers.
This commit is contained in:
parent
4cc3c9691b
commit
d0ae752c1b
|
@ -159,8 +159,8 @@ Boolean gQuantityTouched;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Char barcode[15];
|
Char barcode[15];
|
||||||
UInt16 cases;
|
Char cases[4];
|
||||||
UInt16 units;
|
Char units[4];
|
||||||
} RattailScanRecord;
|
} RattailScanRecord;
|
||||||
|
|
||||||
|
|
||||||
|
@ -794,15 +794,21 @@ static Boolean MainFormDoCommand(UInt16 command)
|
||||||
static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType* bounds)
|
static void DrawCustomTableItem(void* table, Int16 row, Int16 col, RectangleType* bounds)
|
||||||
{
|
{
|
||||||
Char* barcode;
|
Char* barcode;
|
||||||
Char quantity[4];
|
Char* quantity;
|
||||||
Coord x;
|
Coord x;
|
||||||
|
|
||||||
if (col == 0) {
|
if (col == 0) {
|
||||||
|
/*
|
||||||
|
* The barcode string is drawn normally.
|
||||||
|
*/
|
||||||
barcode = (Char*) TblGetItemPtr(table, row, col);
|
barcode = (Char*) TblGetItemPtr(table, row, col);
|
||||||
WinDrawChars(barcode, StrLen(barcode), bounds->topLeft.x, bounds->topLeft.y);
|
WinDrawChars(barcode, StrLen(barcode), bounds->topLeft.x, bounds->topLeft.y);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
StrIToA(quantity, TblGetItemInt(table, row, col));
|
/*
|
||||||
|
* Case and unit quantities are right-justified.
|
||||||
|
*/
|
||||||
|
quantity = (Char*) TblGetItemPtr(table, row, col);
|
||||||
x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(quantity, StrLen(quantity));
|
x = bounds->topLeft.x + bounds->extent.x - FntCharsWidth(quantity, StrLen(quantity));
|
||||||
WinDrawChars(quantity, StrLen(quantity), x, bounds->topLeft.y);
|
WinDrawChars(quantity, StrLen(quantity), x, bounds->topLeft.y);
|
||||||
}
|
}
|
||||||
|
@ -965,8 +971,8 @@ static void MainFormLoadTable(TablePtr table, Boolean updateScroll)
|
||||||
recordP = MemHandleLock(recordH);
|
recordP = MemHandleLock(recordH);
|
||||||
|
|
||||||
TblSetItemPtr(table, row, 0, recordP->barcode);
|
TblSetItemPtr(table, row, 0, recordP->barcode);
|
||||||
TblSetItemInt(table, row, 1, recordP->cases);
|
TblSetItemPtr(table, row, 1, recordP->cases);
|
||||||
TblSetItemInt(table, row, 2, recordP->units);
|
TblSetItemPtr(table, row, 2, recordP->units);
|
||||||
|
|
||||||
MemHandleUnlock(recordH);
|
MemHandleUnlock(recordH);
|
||||||
DmReleaseRecord(db, recordIndex, false);
|
DmReleaseRecord(db, recordIndex, false);
|
||||||
|
@ -1344,16 +1350,22 @@ static void StoreScanRecord()
|
||||||
MemPtr recordP;
|
MemPtr recordP;
|
||||||
TablePtr table;
|
TablePtr table;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure we start off clean. This will make it easier to parse the
|
||||||
|
* record on the PC side, and is probably good practice anyhow.
|
||||||
|
*/
|
||||||
|
MemSet(&record, sizeof(RattailScanRecord), 0);
|
||||||
|
|
||||||
form = FrmGetFormPtr(MainForm);
|
form = FrmGetFormPtr(MainForm);
|
||||||
|
|
||||||
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormBarcode));
|
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormBarcode));
|
||||||
StrCopy(record.barcode, FldGetTextPtr((FieldPtr) ctrl));
|
StrCopy(record.barcode, FldGetTextPtr((FieldPtr) ctrl));
|
||||||
|
|
||||||
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormCases));
|
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormCases));
|
||||||
record.cases = StrAToI(CtlGetLabel(ctrl));
|
StrCopy(record.cases, CtlGetLabel(ctrl));
|
||||||
|
|
||||||
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormUnits));
|
ctrl = FrmGetObjectPtr(form, FrmGetObjectIndex(form, MainFormUnits));
|
||||||
record.units = StrAToI(CtlGetLabel(ctrl));
|
StrCopy(record.units, CtlGetLabel(ctrl));
|
||||||
|
|
||||||
db = OpenScanDatabase();
|
db = OpenScanDatabase();
|
||||||
recordIndex = dmMaxRecordIndex;
|
recordIndex = dmMaxRecordIndex;
|
||||||
|
|
Loading…
Reference in a new issue