mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-23 05:15:54 +02:00
b2/: connect stock to provider
This commit is contained in:
parent
5d7f4fc662
commit
702343cabc
5
b2/db.c
5
b2/db.c
@ -172,8 +172,9 @@ static void dump_stock(FILE *file, const struct stock *s)
|
|||||||
{
|
{
|
||||||
const struct price *p;
|
const struct price *p;
|
||||||
|
|
||||||
fprintf(file, " %s %d %d %s %g",
|
fprintf(file, " %s %s %d %d %s %g",
|
||||||
s->cat, s->avail, s->package, s->curr->name, s->add);
|
s->provider->name, s->cat, s->avail, s->package, s->curr->name,
|
||||||
|
s->add);
|
||||||
for (p = s->price; p; p = p->next)
|
for (p = s->price; p; p = p->next)
|
||||||
fprintf(file, " %d %g", p->qty, p->value);
|
fprintf(file, " %d %g", p->qty, p->value);
|
||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
|
1
b2/db.h
1
b2/db.h
@ -73,6 +73,7 @@ struct provider {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct stock {
|
struct stock {
|
||||||
|
const struct provider *provider;
|
||||||
const char *cat; /* category */
|
const char *cat; /* category */
|
||||||
int avail; /* items in stock */
|
int avail; /* items in stock */
|
||||||
int package; /* "natural" quantity (reel, tray, bag, etc.) */
|
int package; /* "natural" quantity (reel, tray, bag, etc.) */
|
||||||
|
@ -428,6 +428,7 @@ inventory_item:
|
|||||||
WORD WORD stock TOK_NL
|
WORD WORD stock TOK_NL
|
||||||
{
|
{
|
||||||
$$ = part_add($1, $2);
|
$$ = part_add($1, $2);
|
||||||
|
$3->provider = provider_add($1);
|
||||||
part_add_stock($$, $3);
|
part_add_stock($$, $3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -436,6 +437,7 @@ stock:
|
|||||||
WORD int int WORD float prices
|
WORD int int WORD float prices
|
||||||
{
|
{
|
||||||
$$ = alloc_type(struct stock);
|
$$ = alloc_type(struct stock);
|
||||||
|
$$->provider = NULL;
|
||||||
$$->cat = $1;
|
$$->cat = $1;
|
||||||
$$->avail = $2;
|
$$->avail = $2;
|
||||||
$$->package = $3;
|
$$->package = $3;
|
||||||
|
Loading…
Reference in New Issue
Block a user