# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'Invoice'
        db.create_table(u'billing_invoice', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('status', self.gf('django.db.models.fields.CharField')(default='open', max_length=50)),
            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=5, decimal_places=2)),
            ('date', self.gf('django.db.models.fields.DateField')(auto_now_add=True, null=True, blank=True)),
            ('period_from', self.gf('django.db.models.fields.DateField')(null=True)),
            ('period_to', self.gf('django.db.models.fields.DateField')(null=True)),
            ('date_due', self.gf('django.db.models.fields.DateField')(null=True)),
        ))
        db.send_create_signal(u'billing', ['Invoice'])

        # Adding model 'InvoiceDetail'
        db.create_table(u'billing_invoicedetail', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('label', self.gf('django.db.models.fields.CharField')(max_length=100)),
            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=5, decimal_places=2)),
            ('quantity', self.gf('django.db.models.fields.IntegerField')(null=True)),
            ('tax', self.gf('django.db.models.fields.IntegerField')(null=True)),
            ('invoice', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['billing.Invoice'])),
        ))
        db.send_create_signal(u'billing', ['InvoiceDetail'])

        # Adding model 'Payment'
        db.create_table(u'billing_payment', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('payment_means', self.gf('django.db.models.fields.CharField')(max_length=100, null=True)),
            ('amount', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=7, decimal_places=2)),
            ('date', self.gf('django.db.models.fields.DateField')(auto_now_add=True, blank=True)),
            ('invoce', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['billing.Invoice'])),
        ))
        db.send_create_signal(u'billing', ['Payment'])


    def backwards(self, orm):
        # Deleting model 'Invoice'
        db.delete_table(u'billing_invoice')

        # Deleting model 'InvoiceDetail'
        db.delete_table(u'billing_invoicedetail')

        # Deleting model 'Payment'
        db.delete_table(u'billing_payment')


    models = {
        u'billing.invoice': {
            'Meta': {'object_name': 'Invoice'},
            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
            'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
            'date_due': ('django.db.models.fields.DateField', [], {'null': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'period_from': ('django.db.models.fields.DateField', [], {'null': 'True'}),
            'period_to': ('django.db.models.fields.DateField', [], {'null': 'True'}),
            'status': ('django.db.models.fields.CharField', [], {'default': "'open'", 'max_length': '50'})
        },
        u'billing.invoicedetail': {
            'Meta': {'object_name': 'InvoiceDetail'},
            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '5', 'decimal_places': '2'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'invoice': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['billing.Invoice']"}),
            'label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
            'quantity': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
            'tax': ('django.db.models.fields.IntegerField', [], {'null': 'True'})
        },
        u'billing.payment': {
            'Meta': {'object_name': 'Payment'},
            'amount': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '7', 'decimal_places': '2'}),
            'date': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'blank': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'invoce': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['billing.Invoice']"}),
            'payment_means': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'})
        }
    }

    complete_apps = ['billing']