commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

r187 - in gnue-invoice: schema scripts


From: kilo
Subject: r187 - in gnue-invoice: schema scripts
Date: Tue, 4 Jan 2005 08:39:28 -0600 (CST)

Author: kilo
Date: 2005-01-04 08:39:28 -0600 (Tue, 04 Jan 2005)
New Revision: 187

Removed:
   gnue-invoice/schema/invoice.gcd
Modified:
   gnue-invoice/scripts/setup-db-hu.sh
   gnue-invoice/scripts/setup-db.sh
Log:
GNUe Invoice.
Moved invoice.gcd to GNUe-Packages.

Deleted: gnue-invoice/schema/invoice.gcd
===================================================================
--- gnue-invoice/schema/invoice.gcd     2005-01-04 14:12:52 UTC (rev 186)
+++ gnue-invoice/schema/invoice.gcd     2005-01-04 14:39:28 UTC (rev 187)
@@ -1,267 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- INV Module
-
-     Copyright 2004 Free Software Foundation
-
-     This file is part of GNU Enterprise.
-
-     GNU Enterprise is free software; you can redistribute it and/or
-     modify it under the terms of the GNU General Public License as
-     published by the Free Software Foundation; either version 2 of
-     the License, or (at your option) any later version.
-
-     GNU Enterprise is distributed in the hope that it will be useful,
-     but WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-     GNU General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNU Enterprise; see the file COPYING.  If not, write to
-     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
-
-     $Id$ -->
-
-<module name="INV">
-
-  <class name="Company" comment="Seller company's data">
-    <property name="code"       type="string(8)"    nullable="False"    
comment=""/>
-    <property name="name"       type="string(35)"                       
comment=""/>
-    <property name="addr1"      type="string(35)"                       
comment=""/>
-    <property name="addr2"      type="string(35)"                       
comment=""/>
-    <property name="addr3"      type="string(35)"                       
comment=""/>
-    <property name="phone"      type="string(35)"                       
comment=""/>
-    <property name="taxID"      type="string(35)"                       
comment=""/>
-    <property name="currency"   type="string(3)"                        
comment="base currency"/>
-    <property name="accBank"    type="string(35)"                       
comment="Name of bank"/>
-    <property name="accNum"     type="string(35)"                       
comment=""/>
-    <property name="numPrint"   type="number(2)"                        
comment="number of invoices printed by default"/>
-  </class>
-
-  <!--**************************************************
-  Stores information about methods and terms of payment.
-  Also used for calculating the invoice's due date.
-  ***************************************************-->
-  <class name="PaymentMethod"   comment="Payment methods and terms">
-    <property name="name"       type="string(35)"                       
comment="" />
-    <property name="channel"    type="string(35)"   nullable="False"    
comment="cash, transfer, etc." />
-    <property name="dueDays"    type="number(3)"    nullable="False"    
comment="number of days before payment is due" />
-  </class>
-
-
-  <!--***********************************************
-  Represents an invoice item, ie a line on an invoice
-  ************************************************-->
-  <class name="Item"            comment="One item (line) on an invoice">
-    <property name="head"       type="INV_Head"     nullable="False"    
comment="link with invoice head" />
-    <property name="product"    type="ITEM_Item"   nullable="False"    
comment="" />
-    <property name="quantity"   type="number(10,2)" nullable="False"    
comment="" />
-    <property name="note"       type="string"                           
comment="" />
-
-    <property name="valueNet"   type="number(10,2)" >
-      return self.product and (self.quantity * self.product.SALES_price) or 0
-    </property>
-
-    <property name="valueVAT"   type="number(10,2)" >
-      return self.product and 
self.product.SALES_vat.TAX_vatFromNet(inNet=self.valueNet) or 0
-    </property>
-
-    <property name="valueGross" type="number(10,2)" >
-      return self.product and 
self.product.SALES_vat.TAX_grossFromNet(inNet=self.valueNet) or 0
-    </property>
-  </class>
-
-
-  <!--**********************
-  Represents an invoice head
-  ***********************-->
-  <!--
-  <class name="Head"    filter="FILTER_Seller"  comment="Invoice head">
-  -->
-  <class name="Head"    comment="Invoice head">
-    <property name="number"         type="string(20)"           
nullable="False"    comment="invoice number" />
-    <property name="seller"         type="INV_Company"          
nullable="False"    comment="who wants money..." />
-    <property name="buyer"          type="ORG_Org"              
nullable="False"    comment="who pays..." />
-    <property name="paymentMethod"  type="INV_PaymentMethod"    
nullable="False"    comment="" />
-    <property name="dateDelivery"   type="date"                 
nullable="False"    comment="" />
-    <property name="dateIssued"     type="date"                 
nullable="False"    comment="Date when invoice was generated" />
-    <property name="dateDue"        type="date"                 
nullable="False"    comment="Date the payment is due" />
-    <property name="note"           type="string"                              
     comment="" />
-    <property name="printed"        type="number(3)"                           
     comment="# of printed copies" />
-    <property name="reverted"       type="boolean"                             
     comment="If true, no more reverted copies can be made" />
-
-    <property name="totalNet"  type="number(10,2)" >
-      items = find('INV_Item', {'INV_head':self.gnue_id}, [], ['INV_valueNet'])
-      return sum([i.INV_valueNet for i in items])
-    </property>
-
-    <property name="totalVAT"  type="number(10,2)" >
-      items = find('INV_Item', {'INV_head':self.gnue_id}, [], ['INV_valueVAT'])
-      return sum([i.INV_valueVAT for i in items])
-    </property>
-
-    <property name="totalGross"    type="number(10,2)" >
-      items = find('INV_Item', {'INV_head':self.gnue_id}, [], 
['INV_valueGross'])
-      return sum([i.INV_valueGross for i in items])
-    </property>
-
-    <!--******************************************************
-    Return a string (holding the name or only an empty string)
-    each time so that grid form works OK.
-    *******************************************************-->
-    <property name="buyerName"  type="string(35)" >
-      return self.buyer and self.buyer.ORG_shortName or ''
-    </property>
-    
-    <!--******************************************************************
-    Return a string ('REVERTED' or empty) for the invoice report to print.
-    This way the same report can print both normal and reverted invoices.
-    *******************************************************************-->
-    <property name="revertedString" type="string">
-      return self.reverted and "REVERTED" or ''
-    </property>
-
-    <!--************************************
-    Returns summed Net, VAT or Gross values,
-    filtered by VAT rate
-    *************************************-->
-    <procedure name="sumByRate" type="number(10,2)">
-      <parameter name="type" type="string(5)" comment="Net, VAT or Gross"/>
-      <parameter name="rate" type="number(10,2)"/>
-      SumTypes = {
-          'Net':'INV_valueNet', \
-          'VAT':'INV_valueVAT', \
-          'Gross':'INV_valueGross'
-          }
-          
-      try:
-        items = find('INV_Item', \
-            {'INV_head':self.gnue_id, 'INV_product.SALES_vat.TAX_rate':rate}, \
-            [], \
-            [SumTypes[type]])
-            
-        return sum([eval('i.' + SumTypes[type]) for i in items])
-      except KeyError:
-        return 0
-    </procedure>
-    
-    <!--*******************
-    Reverts a given invoice
-    ********************-->
-    <procedure name="revert"    type="string(20)">
-      <parameter name="invId"   type="id"/>
-      invList = find('INV_Head', {'gnue_id': invId}, [], [])
-      try:
-        invOrig = invList[0]
-        if invOrig.INV_reverted == False:
-          invOrig.INV_reverted = True   #cannot make >1 reverted invoices
-
-          invNew = new('INV_Head')
-          invNew.INV_seller         = invOrig.INV_seller
-          invNew.INV_buyer          = invOrig.INV_buyer
-          invNew.INV_paymentMethod  = invOrig.INV_paymentMethod
-          invNew.INV_dateDelivery   = invOrig.INV_dateDelivery
-          invNew.INV_dateIssued     = invOrig.INV_dateIssued
-          invNew.INV_dateDue        = invOrig.INV_dateDue
-          invNew.INV_note           = invOrig.INV_note
-          invNew.INV_printed        = 0
-          invNew.INV_reverted       = True  #cannot revert a reverted 
invoice...
-
-          invItems = find('INV_Item', {'INV_head': invOrig.gnue_id}, [], [])
-          for item in invItems:
-            itemNew                 = new('INV_Item')
-            itemNew.INV_head        = invNew.gnue_id
-            itemNew.INV_product     = item.INV_product
-            itemNew.INV_quantity    = -1 * item.INV_quantity
-            itemNew.INV_note        = item.INV_note
-
-          session.commit()
-          return invNew.INV_number
-        else:
-          return None
-      except:
-        return None
-    </procedure>
-
-    <!--******************************************************
-    Calculates date due based on payment method's day property
-    and the current dateIssued property of the invoice.
-    *******************************************************-->
-    <procedure name="calcDateDue"   type="date" >
-      import mx.DateTime
-      method = self.paymentMethod
-      issued = self.dateIssued
-      if (method is not None) and (issued is not None):
-        dateDue = issued + mx.DateTime.RelativeDate(days=method.INV_dueDays)
-        self.dateDue = dateDue.date
-        return dateDue.date
-      else:
-        self.dateDue = mx.DateTime.today().date
-        return None
-    </procedure>
-
-    <!--***********************************************
-    Generates a new invoice number.
-    Very basic approach, everyone should make this work
-    according to her/his needs.
-    ************************************************-->
-    <procedure name="newNumber" type="string(20)" >
-      invoices = find('INV_Head', {}, ['INV_number'], ['INV_number'])
-
-      if len(invoices):
-        newNum = str(int(invoices[-1].INV_number) + 1).zfill(5)
-      else:
-        newNum = '00001'    #First invoice...
-
-      return newNum
-    </procedure>
-
-    <!--*********
-    Sanity checks
-    **********-->
-    <procedure name="OnValidate">
-      import mx.DateTime
-
-      if self.number is None:
-        self.number = self.newNumber()
-        print 'INV_Head::OnValidate - number set to %s' % self.number
-
-      if self.paymentMethod is None:
-        #TODO: fill paymentMethod with some reasonable value
-        pass
-
-      if self.dateIssued is None:
-        self.dateIssued = mx.DateTime.today().date
-        print 'INV_Head::OnValidate - dateIssued set to %s' % self.dateIssued
-
-      if self.dateDue is None:
-        self.dateDue = self.calcDateDue()
-        print 'INV_Head::OnValidate - dateDue set to %s' % self.dateDue
-
-      if self.dateDelivery is None:
-        self.dateDelivery = mx.DateTime.today().date
-        print 'INV_Head::OnValidate - dateDelivery set to %s' % 
self.dateDelivery
-    </procedure>
-
-    <!--******************
-    Setting default values
-    *******************-->
-    <procedure name="OnInit">
-      import mx.DateTime
-      self.dateIssued = mx.DateTime.today().date
-      print 'INV_Head::OnInit - dateIssued set to %s' % self.dateIssued
-
-      #NULL does not behave well on the form, so better set it to '0'.
-      self.printed = 0
-        
-      self.reverted = False
-      
-      sellerList = find('INV_Company', {'INV_code': '1'}, [], [])
-      if len(sellerList):
-        self.seller = sellerList[0]
-        print 'INV_Head::OnInit - Seller is %s' % self.seller.INV_name
-    </procedure>
-
-  </class>
-</module>

Modified: gnue-invoice/scripts/setup-db-hu.sh
===================================================================
--- gnue-invoice/scripts/setup-db-hu.sh 2005-01-04 14:12:52 UTC (rev 186)
+++ gnue-invoice/scripts/setup-db-hu.sh 2005-01-04 14:39:28 UTC (rev 187)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 
-GNUEDIR="/home/tamas/svn/gnue"
+GNUEDIR="/home/gabor/SVN/gnue"
 PACKAGEDIR="$GNUEDIR/gnue-packages"
 
 DATADIR=`echo -e "import gnue.paths\nprint gnue.paths.data" | gcvs`
@@ -14,9 +14,9 @@
                                                                        
"$PACKAGEDIR/base/org/org.gcd"      \
                                                                        
"$PACKAGEDIR/base/item/item.gcd"    \
                                                                        
"$PACKAGEDIR/sales/sales.gcd"           \
-                                                                       
"$PACKAGEDIR/finance/tax/tax.gcd"
+                                                                       
"$PACKAGEDIR/finance/tax/tax.gcd"       \
+                                                                       
"$PACKAGEDIR/finance/invoice/invoice.gcd"
 
-gcdcvs --connection=invoice-backend ../schema/invoice.gcd
 gcdcvs --connection=invoice-backend ../schema/invoice-hu.gcd
 
 #standard data

Modified: gnue-invoice/scripts/setup-db.sh
===================================================================
--- gnue-invoice/scripts/setup-db.sh    2005-01-04 14:12:52 UTC (rev 186)
+++ gnue-invoice/scripts/setup-db.sh    2005-01-04 14:39:28 UTC (rev 187)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-GNUEDIR="/home/tamas/svn/gnue"
+GNUEDIR="/home/gabor/SVN/gnue"
 PACKAGEDIR="$GNUEDIR/gnue-packages"
 
 DATADIR=`echo -e "import gnue.paths\nprint gnue.paths.data" | gcvs`
@@ -13,9 +13,8 @@
                                                                        
"$PACKAGEDIR/base/org/org.gcd"      \
                                                                        
"$PACKAGEDIR/base/item/item.gcd"    \
                                                                        
"$PACKAGEDIR/sales/sales.gcd"           \
-                                                                       
"$PACKAGEDIR/finance/tax/tax.gcd"
+                                                                       
"$PACKAGEDIR/finance/tax/tax.gcd"       \
+                                                                       
"$PACKAGEDIR/finance/invoice/invoice.gcd"
 
-gcdcvs --connection=invoice-backend ../schema/invoice.gcd
-
 #standard data
 gsscvs --connection=invoice-backend ../schema/invoice-en.gsd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]