Commit f157f9a4 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

* Major admin interface changes

* Added preliminary support for payments to suppliers
parent fa4ef808
......@@ -260,6 +260,8 @@ CREATE TABLE payments (
SupplierID BIGINT UNSIGNED NOT NULL,
GLAccID BIGINT UNSIGNED NOT NULL, # Sending account
PaymentNumber VARCHAR(128), # Payment number
TransDate DATE NOT NULL,
Ref VARCHAR(128), # Reference on account statement
Amount DECIMAL(10,2) NOT NULL,
......
......@@ -36,10 +36,11 @@ sub ping {
# Parameters:
# SupplierRef - Supplier reference
# GLAccRef - GL account where money was paid from
# PaymentNumber - Reference for this payment
# Date - Date of payment
# Ref - GL account entry reference (bank statement reference for example)
# Amount - Amount
sub createTransaction {
sub createPayment {
my (undef,$data) = @_;
# Check if client is authorized to access this function
......@@ -56,6 +57,10 @@ sub createTransaction {
return -101;
}
if (!defined($data->{'PaymentNumber'}) || $data->{'PaymentNumber'} eq "") {
return -101;
}
if (!defined($data->{'Date'}) || $data->{'Date'} eq "") {
return -101;
}
......@@ -74,6 +79,7 @@ sub createTransaction {
my $detail;
$detail->{'SupplierRef'} = $data->{'SupplierRef'};
$detail->{'GLAccRef'} = $data->{'GLAccRef'};
$detail->{'PaymentNumber'} = $data->{'PaymentNumber'};
$detail->{'Date'} = $data->{'Date'};
$detail->{'Ref'} = $data->{'Ref'};
$detail->{'Amount'} = $data->{'Amount'};
......
......@@ -196,6 +196,7 @@ sub registerPlugin {
# If no info, return
if (!defined($info)) {
print(STDERR "WARNING: Plugin info not found for plugin => $plugin\n");
return -1;
}
......
This diff is collapsed.
......@@ -22,6 +22,69 @@ use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Clients",
Menu => [
# Clients main menu option
{
MenuItem => "Clients",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create a client",
Help => 'create ref="<reference>" name="<client name>" [reg="<registration num>"] [taxref="<tax reference number>"] glacc="<GL account>" [contactperson="<contact person name>"] [createsubacc="<y to create sub account>"]',
Function => \&create,
},
{
MenuItem => "LinkAddr",
Regex => "linkaddr",
Desc => "Link in an address",
Help => 'linkaddr client="<client ref>" type="<billing or shipping>" address="<address>"',
Function => \&linkAddress,
},
{
MenuItem => "LinkEmail",
Regex => "linkemail",
Desc => "Link in an email address",
Help => 'linkemail(?:addr)? client="<client ref>" type="<accounts or general>" address="<address>"',
Function => \&linkEmailAddress,
},
{
MenuItem => "LinkPhNum",
Regex => "linkphnum",
Desc => "Link in a phone number",
Help => 'linkphnum client="<client ref>" type="<phone or fax>" phnumber="<phone number>" [name="<name>"]',
Function => \&linkPhoneNumber,
},
{
MenuItem => "Remove",
Regex => "remove",
Desc => "Remove client",
Help => 'remove client="<client ref>"',
Function => \&remove,
},
{
MenuItem => "List",
Regex => "list",
Desc => "Display list of clients",
Help => 'list',
Function => \&list,
},
{
MenuItem => "Show",
Regex => "show",
Desc => "Show client",
Help => 'show client="<client ref>"',
Function => \&show,
},
],
},
],
};
# List clients
sub list
{
......
......@@ -22,6 +22,20 @@ use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Engine",
Menu => [
# Engine main menu option
{
MenuItem => "Engine",
Children => [
],
},
],
};
1;
......
......@@ -21,6 +21,96 @@ use wiaflos::client::misc;
use wiaflos::client::soap;
use wiaflos::client::reportwriter;
use Math::BigFloat;
Math::BigFloat::precision(-2);
# Plugin info
our $pluginInfo = {
Name => "GL",
Menu => [
# GL main menu option
{
MenuItem => "GL",
Children => [
{
MenuItem => "Chart",
Regex => "chart",
Desc => "Display chart of accounts",
Help => 'chart [format="<text or html>"]',
Function => \&chart,
},
{
MenuItem => "Show",
Regex => "show",
Desc => "Show an account",
Help => 'show acc="<account ref>"',
Function => \&show,
},
{
MenuItem => "CreateAccount",
Regex => "createaccount",
Desc => "Create account",
Help => 'createaccount ref="<account ref>" name="<account name>" fincat="<financial category>" rwcat="<reporting category>" [parentacc="<parent account>"]',
Function => \&createAccount,
},
{
MenuItem => "Transactions",
Regex => "trans(?:actions)?",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create transaction",
Help => 'create date="<YYYY-MM-DD>" ref="<reference>"',
Function => \&createTransaction,
},
{
MenuItem => "List",
Regex => "list",
Desc => "List transactions",
Help => 'list',
Function => \&listTransactions,
},
{
MenuItem => "Link",
Regex => "link",
Desc => "Link transactions",
Help => 'link transid="<transaction id>" acc="<account ref>" amount="<amount>" [ref="<reference>"]',
Function => \&linkTransactions,
},
{
MenuItem => "Post",
Regex => "post",
Desc => "post transactions",
Help => 'post transid="<transaction id>"',
Function => \&postTransaction,
},
{
MenuItem => "Remove",
Regex => "remove",
Desc => "Remove transactions",
Help => 'remove transid="<transaction id>"',
Function => \&removeTransaction,
},
{
MenuItem => "Show",
Regex => "show",
Desc => "Display transaction entries",
Help => 'show transid="<transaction id>"',
Function => \&showTransaction,
},
],
},
],
},
],
};
# GL chart of accounts
......
......@@ -22,6 +22,45 @@ use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Inventory",
Menu => [
# Inventory main menu option
{
MenuItem => "Inventory",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create inventory item",
Help => 'create ref="<ref>" type="<product or service>" [mode="<bulk or track for products>"] '.
'desc="<description>" incomeacc="<income account>" [inventoryacc="<inventory account>"] '.
'[expenseacc="<expense account>"] sellprice="<sell price>" taxtype="<tax type>" '.
'taxmode="<price is incl or excl>" [discountable="<yes or no>"]',
Function => \&create,
},
{
MenuItem => "Remove",
Regex => "remove",
Desc => "Remove inventory item",
Help => 'remove item="<item ref>"',
Function => \&remove,
},
{
MenuItem => "List",
Regex => "list",
Desc => "Display list of inventory items",
Help => 'list',
Function => \&list,
},
],
},
],
};
# List inventory items
sub list
......
......@@ -22,6 +22,76 @@ use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Invoicing",
Menu => [
# Clients main menu option
{
MenuItem => "Clients",
Children => [
{
MenuItem => "Invoicing",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create a client invoice",
Help => 'create client="<client ref>" invoicenum="<reference>" [shipaddress="<shipping address>"] issuedate="<issue date" duedate="<due date>" [ordernum="<order number>"] [note="<notes>]"',
Function => \&createInvoice,
},
{
MenuItem => "LinkInventory",
Regex => "linkinvent(?:ory)?",
Desc => "Link inventory item",
Help => 'linkinvent invoice="<invoice number>" inventory="<inventory item ref>" [desc="<description of item>"] qty="<quantity>" [unitprice="<unit price>"] [discount="<discount>"]',
Function => \&linkInventoryItem,
},
{
MenuItem => "RemoveItem",
Regex => "removeitem",
Desc => "Remove item from invoice",
Help => 'removeitem invoice="<invoice number>" itemid="<item id>"',
Function => \&removeItem,
},
{
MenuItem => "list",
Regex => "list",
Desc => "Display list of client invoices",
Help => 'list',
Function => \&list,
},
{
MenuItem => "build",
Regex => "build",
Desc => "Build client invoice",
Help => 'bulid invoice="<invoice number>" writeto="<email[:addy1,addy2...] or file:filename>"',
Function => \&build,
},
{
MenuItem => "Show",
Regex => "show",
Desc => "Show client invoice",
Help => 'show invoice="<invoice number>"',
Function => \&show,
},
{
MenuItem => "Post",
Regex => "post",
Desc => "Post client invoice",
Help => 'post invoice="<invoice number>"',
Function => \&post,
},
],
},
],
},
],
};
# List client invoices
sub list
......
# Author: Nigel Kukard <nkukard@lbsd.net>
# Date: 12/03/2007
# Desc: Payments functions
# License: GPL
package wiaflos::client::cmdline::Payments;
use strict;
# Exporter stuff
require Exporter;
our (@ISA,@EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(
);
use wiaflos::client::misc;
use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Payments",
Menu => [
# Suppliers main menu option
{
MenuItem => "Suppliers",
Children => [
# Purchasing
{
MenuItem => "Purchasing",
Children => [
# Payments
{
MenuItem => "Payments",
Regex => "pay(?:ments)?",
Children => [
{
MenuItem => "createpayment",
Regex => "createpay(?:ment)?",
Desc => "Create a payment",
Help => 'create supplier="<supplier ref>" glacc="<source of payment>" paymentnum="<payment reference>" date="<payment date>" ref="<journal ref>" amount="<amount paid>"',
Function => \&createPayment,
}
],
},
],
},
],
},
],
};
# Create payment
sub createPayment
{
my ($OUT,@args) = @_;
my $parms = parseArgs(@args);
if (!defined($parms->{'supplier'})) {
return -202;
}
if (!defined($parms->{'glacc'})) {
return -202;
}
if (!defined($parms->{'paymentnum'})) {
return -202;
}
if (!defined($parms->{'date'})) {
return -202;
}
if (!defined($parms->{'ref'})) {
return -202;
}
if (!defined($parms->{'amount'})) {
return -202;
}
my $detail;
$detail->{'SupplierRef'} = $parms->{'supplier'};
$detail->{'GLAccRef'} = $parms->{'glacc'};
$detail->{'PaymentNumber'} = $parms->{'invoicenum'};
$detail->{'Date'} = $parms->{'date'};
$detail->{'Ref'} = $parms->{'ref'};
$detail->{'Amount'} = $parms->{'amount'};
my $res = soapCall($OUT,"Payments","createPayment",$detail);
if ($res == -2) {
print($OUT " => Database error\n");
} elsif ($res == -3) {
print($OUT " => Parameter problem\n");
}
return $res;
}
1;
# vim: ts=4
......@@ -22,6 +22,76 @@ use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Purchasing",
Menu => [
# Suppliers main menu option
{
MenuItem => "Suppliers",
Children => [
{
MenuItem => "Purchasing",
Regex => "purchas(?:ing)?",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create a supplier invoice",
Help => 'create supplier="<supplier ref>" invoicenum="<reference>" supplierinvnum="<suppliers invoice number>" issuedate="<issue date" duedate="<due date>" [ordernum="<order number>"] [subtotal="<sub total>"] [taxtotal="<tax total>"] [invtotal="<inv total>"] [note="<notes>]"',
Function => \&createInvoice,
},
{
MenuItem => "LinkInventory",
Regex => "linkinvent(?:ory)?",
Desc => "Link inventory item",
Help => 'linkinvent invoice="<invoice ref>" inventory="<inventory item>" desc="<description of item>" [ref="<item ref, ie. serial number>"] qty="<quantity>" [unit="<unit>"] unitprice="<unit price>" discount="<discount>" taxtypeid="<tax type id>" taxmode="<incl or excl>"',
Function => \&linkInventoryItem,
},
{
MenuItem => "LinkExpense",
Regex => "linkexp(?:ense)?",
Desc => "Link expense item",
Help => 'linkexp invoice="<invoice ref>" acc="<expense account>" desc="<description of item>" [ref="<item ref, ie. serial number>"] qty="<quantitiy>" [unit="<unit>"] unitprice="<unitprice>" discount="<discount in %>" taxtypeid="<tax type id>" taxmode="<incl or excl>"',
Function => \&linkExpenseItem,
},
{
MenuItem => "RemoveItem",
Regex => "removeitem",
Desc => "Remove item from invoice",
Help => 'removeitem invoice="<invoice number>" itemid="<item id>"',
Function => \&removeItem,
},
{
MenuItem => "list",
Regex => "list",
Desc => "Display list of supplier invoices",
Help => 'list',
Function => \&list,
},
{
MenuItem => "Show",
Regex => "show",
Desc => "Show supplier invoice",
Help => 'show invoice="<invoice number>"',
Function => \&show,
},
{
MenuItem => "Post",
Regex => "post",
Desc => "Post supplier invoice",
Help => 'post invoice="<invoice number>"',
Function => \&post,
},
],
},
],
},
],
};
# List supplier invoices
sub list
......
......@@ -21,6 +21,69 @@ use wiaflos::client::misc;
use wiaflos::client::soap;
use wiaflos::client::reportwriter;
# Plugin info
our $pluginInfo = {
Name => "Suppliers",
Menu => [
# Suppliers main menu option
{
MenuItem => "Suppliers",
Children => [
{
MenuItem => "Create",
Regex => "create",
Desc => "Create a supplier",
Help => 'create ref="<reference>" name="<supplier name>" [reg="<registration num>"] [taxref="<tax reference number>"] acc="<GL account>" [contactperson="<contact person name>"] [createsubacc="<y to create sub account>"]',
Function => \&create,
},
{
MenuItem => "LinkAddr",
Regex => "linkaddr",
Desc => "Link in an address",
Help => 'linkaddr supplier="<supplier ref>" type="<billing or shipping>" address="<address>"',
Function => \&linkAddress,
},
{
MenuItem => "LinkEmail",
Regex => "linkemail",
Desc => "Link in an email address",
Help => 'linkemail(?:addr)? supplier="<supplier ref>" type="<accounts or general>" address="<address>"',
Function => \&linkEmailAddress,
},
{
MenuItem => "LinkPhNum",
Regex => "linkphnum",
Desc => "Link in a phone number",
Help => 'linkphnum supplier="<supplier ref>" type="<phone or fax>" phnumber="<phone number>" [name="<name>"]',
Function => \&linkPhoneNumber,
},
{
MenuItem => "Remove",
Regex => "remove",
Desc => "Remove supplier",
Help => 'remove supplier="<supplier ref>"',
Function => \&remove,
},
{
MenuItem => "List",
Regex => "list",
Desc => "Display list of suppliers",
Help => 'list',
Function => \&list,
},
{
MenuItem => "Show",
Regex => "show",