def setPeopleDetails(self): if request.params["submit"] == "Save": queryParams = [ request.params["peopleCode"], request.params["peopleName"], request.params["people_type"], request.params["address"], request.params["city"], request.params["pincode"], request.params["state"], request.params["country"], request.params["telephone"], request.params["fax"], request.params["creditPeriod"], request.params["balanceLimit"], request.params["website"], request.params["email"], request.params["contactPersonDetails"] ] master = app_globals.server_proxy.people.getPeopleMaster( session["gnukhata"]) for r in master: queryParams.append(request.params[r[1].replace(" ", "_")]) app_globals.server_proxy.people.setPeopleDetails( queryParams, session["gnukhata"]) c.master = app_globals.server_proxy.people.getPeopleMaster( session["gnukhata"]) c.details = app_globals.server_proxy.people.getAllPeople( session["gnukhata"]) c.flag = 'n' return render('/people.mako') else: c.master = app_globals.server_proxy.people.getPeopleMaster( session["gnukhata"]) c.flag = 'n' return render('/customization.mako')
def addCustomize(self): if request.params["submit"] == "Customize": queryParams = [] for r in range(0,len(request.params.getall('attr_name'))): queryParams.append([request.params.getall('attr_name')[r],request.params.getall('attr_type')[r]]) customize = app_globals.server_proxy.people.setPeopleMaster(queryParams,session["gnukhata"]) c.flag = 'n' c.master = app_globals.server_proxy.people.getPeopleMaster(session["gnukhata"]) return render('/customization.mako') else: return render('/people.mako')
def createProfitLoss(self): """ Purpose: creates profit loss Inputs: none """ self.report_variables() # for mentioning the period for trial balance if c.orgtype == "Profit Making": statement = "PROFIT AND LOSS ACCOUNT FOR THE YEAR FROM " + session['financialfrom'] + " TO " + request.params["to_date"] c.statement = statement if c.orgtype == "NGO": statement = "INCOME AND EXPENDITURE FOR THE YEAR FROM " + session['financialfrom'] + " TO " + request.params["to_date"] c.statement = statement fromdate = datetime.datetime.strptime(str( session['financialfrom']),"%d-%m-%Y").strftime("%Y-%m-%d %H:%M:%S") todate = datetime.datetime.strptime(str(request.params["to_date"]),"%d-%m-%Y").strftime("%Y-%m-%d %H:%M:%S") trialdata = app_globals.server_proxy.reports.getProfitLoss([fromdate,fromdate,todate],session["gnukhata"]) c.trialdata = trialdata c.length = len(trialdata) - int(10) c.grandTotal =trialdata[len(trialdata) - int(1)] c.netTotal = trialdata[len(trialdata) - int(2)] c.dirincm = trialdata[len(trialdata) - int(10)] c.direxp = trialdata[len(trialdata) - int(9)] c.indirincm = trialdata[len(trialdata) - int(8)] c.indirexp = trialdata[len(trialdata) - int(7)] c.grossFlag = trialdata[len(trialdata) - int(6)] c.grossProfitloss = trialdata[len(trialdata) - int(5)] c.netFlag = trialdata[len(trialdata) - int(4)] c.netProfitloss = trialdata[len(trialdata) - int(3)] if c.reportFlag == "balancesheet": return [c.netFlag, c.netProfitloss] else: return render("/Profit_and_Loss_view.mako")
def getOrgDetails(self): self.getEssentials() c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] #print c.organisationType c.states = self.getStates() org_details = app_globals.server_proxy.organisation.getOrganisation(session["gnukhata"]) #print org_details for org in org_details: res = [org[0],org[1],org[2],org[3],org[4],org[5],org[6],org[7],org[8],org[9],org[10],org[11],org[12],org[13],org[14],org[15],org[16],org[17],org[18]] #print res c.orgcode = org[0] c.orgname = org[1] c.orgtype = org[2] c.orgaddr = org[3] c.city = org[4] c.pincode = org[5] c.state = org[6] c.country = org[7] c.telno = org[8] c.fax = org[9] c.website = org[10] c.email = org[11] c.pan = org[12] c.stax = org[13] c.mvat = org[14] c.regno = org[15] c.regdate = org[16] c.fcrano = org[17] c.fcradate = org[18] #print c.orgaddr session['orgtype'] = c.orgtype #print app_globals.orgtype return render('/organisation.mako')
def setOrganisation(self): if (c.organisationType == "NGO"): self.queryParams = [ c.orgname, request.params["orgadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["website"], request.params["email"], request.params["pan"], "", "", request.params["reg_no"], request.params["reg_date"], request.params["fcra_no"], request.params["fcra_date"] ] app_globals.server_proxy.organisation.setOrganisation( self.queryParams, session["gnukhata"]) else: self.queryParams = [ c.orgname, request.params["orgadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["website"], request.params["email"], request.params["pan"], request.params["stax_no"], request.params["mvat_no"], "", "", "", "" ] app_globals.server_proxy.organisation.setOrganisation( self.queryParams, session["gnukhata"]) return render("/organisation.mako")
def setVoucherAccount(self): startdate = session['financialfrom'] print "This is the startdate" print startdate financial_start = datetime.datetime.strptime(str(startdate),"%d-%m-%Y").strftime("%Y-%m-%d") lastDate = app_globals.server_proxy.transaction.getLastReffDate([financial_start], session['gnukhata']) lastReffNo = app_globals.server_proxy.transaction.getLastReference(session['gnukhata']) c.lastReffDate = lastDate c.lastReference = lastReffNo if request.params["acc_code"] == "manually": self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],0,0,request.params["suggest_acc_code"]] else: self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],0,0,""] app_globals.server_proxy.account.setAccount(self.queryParams,session["gnukhata"]) projects = app_globals.server_proxy.organisation.getAllProjects(session['gnukhata']) if projects == False: c.projects = "" else: c.projects = projects c.flag == "n" c.vouchertype = request.params["backto_voucher"] c.addaccount = "add" c.alertmessage = "Account " + request.params["accountname"]+ " added succesfully " startdate = session['financialfrom'] enddate = session['financialto'] c.financialfroms = startdate[6:] + "," + startdate[3:-5] + "," + startdate[:2] c.financialtos = enddate[6:] + "," + enddate[3:-5] + "," + enddate[:2] self.getEssentials() return render("/voucher.mako")
def setAccount(self): print request.params if request.params["acc_code"] == "manually": self.queryParams = [ request.params["groupname"], request.params["subgroupname"], request.params["newSub"], request.params["accountname"], request.params["acc_code"], request.params["openingbalance"], request.params["openingbalance"], request.params["suggest_acc_code"] ] else: self.queryParams = [ request.params["groupname"], request.params["subgroupname"], request.params["newSub"], request.params["accountname"], request.params["acc_code"], request.params["openingbalance"], request.params["openingbalance"], "" ] app_globals.server_proxy.account.setAccount(self.queryParams, session["gnukhata"]) if request.params["newSub"] != "": app_globals.server_proxy.groups.setSubGroup( [request.params["groupname"], request.params["newSub"]], session["gnukhata"]) c.forward = "enable" c.accountname = request.params["accountname"] c.newsubgroup = request.params["newSub"] if request.params["acc_code"] == "manually": c.account_code = request.params["suggest_acc_code"] self.create_account() return render("/createaccount.mako")
def setPeopleDetails(self): if request.params["submit"] == "Save": queryParams=[request.params["peopleCode"],request.params["peopleName"],request.params["people_type"],request.params["address"],request.params["city"],request.params["pincode"],request.params["state"],request.params["country"],request.params["telephone"],request.params["fax"],request.params["creditPeriod"],request.params["balanceLimit"],request.params["website"],request.params["email"],request.params["contactPersonDetails"]] master = app_globals.server_proxy.people.getPeopleMaster(session["gnukhata"]) for r in master: queryParams.append(request.params[r[1].replace(" ","_")]) app_globals.server_proxy.people.setPeopleDetails(queryParams,session["gnukhata"]) c.master = app_globals.server_proxy.people.getPeopleMaster(session["gnukhata"]) c.details = app_globals.server_proxy.people.getAllPeople(session["gnukhata"]) c.flag = 'n' return render('/people.mako') else: c.master = app_globals.server_proxy.people.getPeopleMaster(session["gnukhata"]) c.flag = 'n' return render('/customization.mako')
def deploy(self): queryParams = [request.params["orgname"],request.params["financialyearfrom"],request.params["financialyearto"],request.params["organisationType"]] #print queryParams #now a call to the Deploy function in the core engine will be made #the return value (setupStatus) is a list of 2 elements. #first element [0] is a boolean value. It is true if deployment is successful. #the second element, [1] is the clientid. #obviously if the deployment is successful, we want to connect to the database and get a client id. self.setupStatus = app_globals.server_proxy.Deploy(queryParams) #app_globals.clientid_list = {request.params["orgname"]:self.setupStatus[1]} session['gnukhata'] = self.setupStatus[1] session['orgname'] = request.params["orgname"] session['financialfrom'] = request.params["financialyearfrom"] session['financialto'] = request.params["financialyearto"] session['clientid'] = session['gnukhata'] session.save() c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] c.organisationType = request.params["organisationType"] if (c.organisationType == "NGO"): reg_date = request.params["reg_dated"] +"-"+ request.params["reg_datem"] +"-"+ request.params["reg_datey"] fcra_date = request.params["fcra_dated"] +"-"+ request.params["fcra_datem"] +"-"+ request.params["fcra_datey"] self.queryParams = [c.orgname,c.organisationType,request.params["orgadd"],request.params["cities"],request.params["postal"],request.params["states"],request.params["country"],request.params["telno"],request.params["faxno"],request.params["website"],request.params["email"],request.params["pan"],"","",request.params["reg_no"],reg_date,request.params["fcra_no"],fcra_date] app_globals.server_proxy.organisation.setOrganisation(self.queryParams,session["gnukhata"]) else: self.queryParams = [c.orgname,c.organisationType,request.params["orgadd"],request.params["cities"],request.params["postal"],request.params["states"],request.params["country"],request.params["telno"],request.params["faxno"],request.params["website"],request.params["email"],request.params["pan"],request.params["stax_no"],request.params["mvat_no"],"","","",""] app_globals.server_proxy.organisation.setOrganisation(self.queryParams,session["gnukhata"]) #return "the client id is " + str(self.setupStatus[1]) return render('/mainpage.mako')
def setPreferences(self): #print request.params length = request.params["hidden_length"] #print type(length) if request.params["hidden_has_project"] == "hasproject": for i in range(1, int(length)): queryParams = [ request.params["projname" + str(i)], request.params["projamount" + str(i)] ] #print queryParams app_globals.server_proxy.organisation.setProjects( queryParams, session["gnukhata"]) queryParams = [1, request.params["hidden_refno"]] app_globals.server_proxy.organisation.setPreferences( queryParams, session["gnukhata"]) queryParams = [2, request.params["hidden_acc_code"]] app_globals.server_proxy.organisation.setPreferences( queryParams, session["gnukhata"]) c.message = "Your Preferences Have Been Saved" self.create_account() c.flag = "e" return render('/mainpage.mako')
def adduser(self): self.create_variables() queryParams = [request.params["username"],request.params["password"],request.params["role"]] loginStatus = app_globals.server_proxy.user.setUser(queryParams,session['gnukhata']) c.messageuser = "******" c.addflag = "adduser" return render('/main.mako')
def setVendor(self): #if user is entering new vendor. then flag = "n". #self.queryParams = [] c.flag = request.params["flag"] #print c.flag if c.flag == "n": self.queryParams = [ request.params["vndname"], request.params["vndadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["taxno"], request.params["creditprd"], request.params["website"], request.params["email"], request.params["contactdetails"] ] app_globals.server_proxy.vendor.setVendor(self.queryParams, session["gnukhata"]) #c.displayStatus = True # if user is editing vendor. then flag = "e". if c.flag == "e": c.vendor = self.selectVendor() #print c.vendor[5] c.cities = app_globals.server_proxy.data.getCityNames( [c.vendor[5]], session["gnukhata"]) #print c.cities #print c.vendor[3] c.vendors = self.getVendor() return render("/vendor.mako")
def setOrganisation(self): if (c.organisationType == "NGO"): self.queryParams = [c.orgname,request.params["orgadd"],request.params["cities"],request.params["postal"],request.params["states"],request.params["country"],request.params["telno"],request.params["faxno"],request.params["website"],request.params["email"],request.params["pan"],"","",request.params["reg_no"],request.params["reg_date"],request.params["fcra_no"],request.params["fcra_date"]] app_globals.server_proxy.organisation.setOrganisation(self.queryParams,session["gnukhata"]) else: self.queryParams = [c.orgname,request.params["orgadd"],request.params["cities"],request.params["postal"],request.params["states"],request.params["country"],request.params["telno"],request.params["faxno"],request.params["website"],request.params["email"],request.params["pan"],request.params["stax_no"],request.params["mvat_no"],"","","",""] app_globals.server_proxy.organisation.setOrganisation(self.queryParams,session["gnukhata"]) return render("/organisation.mako")
def index(self): # Return a rendered template c.master = app_globals.server_proxy.people.getPeopleMaster( session["gnukhata"]) c.details = app_globals.server_proxy.people.getAllPeople( session["gnukhata"]) c.flag = 'n' return render('/people.mako')
def dbconnect(self): self.queryParams = [request.params['username'],request.params['password']] self.loginStatus = app_globals.server_proxy.user.getUser(self.queryParams,session['gnukhata']) print self.loginStatus #if self.loginStatus == False: # c.alert = "Please enter valid username and password" #else: return render('/mainpage.mako')
def getPeopleDetails(self): c.master = app_globals.server_proxy.people.getPeopleMaster( session["gnukhata"]) c.details = app_globals.server_proxy.people.getAllPeople( session["gnukhata"]) c.getDetails = app_globals.server_proxy.people.getPeopleDetails( ['code', request.params['detail_row']], session["gnukhata"]) c.flag = 'e' return render('/people.mako')
def viewVoucher(self): self.voucher_variable() queryParams = [request.params["vouchercode"]] voucher_master = app_globals.server_proxy.transaction.getVoucherMaster(queryParams, session["gnukhata"]) startdate = session["financialfrom"] enddate = session["financialto"] c.financialfroms = startdate[6:] + "," + startdate[3:-5] + "," + startdate[:2] c.financialtos = enddate[6:] + "," + enddate[3:-5] + "," + enddate[:2] if request.params.has_key("from_date"): c.from_date = request.params["from_date"] else: c.from_date = "" if request.params.has_key("to_date"): c.to_date = request.params["to_date"] else: c.to_date = "" c.vouchercode = queryParams[0] c.vouchertypeflag = voucher_master[2] c.reference = voucher_master[0] c.date_of_transaction = voucher_master[1] narration = voucher_master[3] c.narration = "\n".join(narration[i : i + 40] for i in xrange(0, len(narration), 40)) c.prjnam = voucher_master[4] projects = app_globals.server_proxy.organisation.getAllProjects(session["gnukhata"]) # print projects[0][1] if projects == False: c.projects = "" # c.prjnam = "" else: c.projects = projects print c.projects c.details = app_globals.server_proxy.transaction.getVoucherDetails(queryParams, session["gnukhata"]) c.length = len(c.details) if request.params["cflag"] == "set": c.clonFlag = "cf" else: c.clonFlag = "ef" c.search_value = request.params["search_value"] c.search_flag = request.params["search_flag"] c.search_by_narration = request.params["search_by_narration"] c.ledgerFlag = int(request.params["ledgerflag"]) if int(c.ledgerFlag) == 1: c.ledgerFlag = 2 if int(c.ledgerFlag) >= 1: c.calculateFrom = request.params["from_date"] c.calculateTo = request.params["to_date"] c.ledgerAccount = request.params["accountname"] c.financial_from = request.params["financial_from"] c.narrationflag = request.params["with_narration"] c.project = request.params["projects"] if request.params.has_key("tb_type"): c.tb_type = request.params["tb_type"] else: c.tb_type = "" return render("/voucher_view.mako")
def index(self): #populate the list of organisations and attach it to the context variable to be used in mako template orgname = app_globals.server_proxy.getOrganisationNames() orgname.sort() c.organisations = orgname #c.message = "" # Return a rendered template return render('/start_up.mako')
def index(self): self.create_account() c.forward = "disable" c.flagnew = "n" startdate = session['financialfrom'] enddate = session['financialto'] c.financialfroms = startdate[6:] + "," + startdate[3:-5] + "," + startdate[:2] c.financialtos = enddate[6:] + "," + enddate[3:-5] + "," + enddate[:2] return render('/createaccount.mako')
def deploy(self): queryParams = [ request.params["orgname"], request.params["financialyearfrom"], request.params["financialyearto"], request.params["organisationType"] ] #print queryParams #now a call to the Deploy function in the core engine will be made #the return value (setupStatus) is a list of 2 elements. #first element [0] is a boolean value. It is true if deployment is successful. #the second element, [1] is the clientid. #obviously if the deployment is successful, we want to connect to the database and get a client id. self.setupStatus = app_globals.server_proxy.Deploy(queryParams) #app_globals.clientid_list = {request.params["orgname"]:self.setupStatus[1]} session['gnukhata'] = self.setupStatus[1] session['orgname'] = request.params["orgname"] session['financialfrom'] = request.params["financialyearfrom"] session['financialto'] = request.params["financialyearto"] session['clientid'] = session['gnukhata'] session.save() c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] c.organisationType = request.params["organisationType"] if (c.organisationType == "NGO"): reg_date = request.params["reg_dated"] + "-" + request.params[ "reg_datem"] + "-" + request.params["reg_datey"] fcra_date = request.params["fcra_dated"] + "-" + request.params[ "fcra_datem"] + "-" + request.params["fcra_datey"] self.queryParams = [ c.orgname, c.organisationType, request.params["orgadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["website"], request.params["email"], request.params["pan"], "", "", request.params["reg_no"], reg_date, request.params["fcra_no"], fcra_date ] app_globals.server_proxy.organisation.setOrganisation( self.queryParams, session["gnukhata"]) else: self.queryParams = [ c.orgname, c.organisationType, request.params["orgadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["website"], request.params["email"], request.params["pan"], request.params["stax_no"], request.params["mvat_no"], "", "", "", "" ] app_globals.server_proxy.organisation.setOrganisation( self.queryParams, session["gnukhata"]) #return "the client id is " + str(self.setupStatus[1]) return render('/mainpage.mako')
def index(self): self.create_account() c.forward = "disable" c.flagnew = "n" startdate = session['financialfrom'] enddate = session['financialto'] c.financialfroms = startdate[6:] + "," + startdate[ 3:-5] + "," + startdate[:2] c.financialtos = enddate[6:] + "," + enddate[3:-5] + "," + enddate[:2] return render('/createaccount.mako')
def setProduct(self): #self.queryParams = [] self.queryParams = [request.params["prodcode"],request.params["prodname"],request.params["productdesc"],request.params["costprice"],request.params["saleprice"],request.params["quantity"],0] self.queryParams2 = request.params["type"] #print "type" #print self.queryParams2 app_globals.server_proxy.product.setProduct([self.queryParams2],self.queryParams,session["gnukhata"]) c.products = self.getAllProducts() c.displayStatus = True return render("/product.mako")
def printVoucherView(self): self.voucher_variable() c.orgname = session['orgname'] c.customer = request.params["custname_txt"] c.amount_txt = request.params["amount_txt"] c.particulars_txt = request.params["particulars_txt"] c.refno_txt = request.params["refno_txt"] c.voucher_flag = request.params["voucher_flag"] c.statement = "Voucher" c.date = request.params["date"] return render('/voucherprintview.mako')
def printVoucherView(self): self.voucher_variable() c.orgname = session["orgname"] c.customer = request.params["custname_txt"] c.amount_txt = request.params["amount_txt"] c.particulars_txt = request.params["particulars_txt"] c.refno_txt = request.params["refno_txt"] c.voucher_flag = request.params["voucher_flag"] c.statement = "Voucher" c.date = request.params["date"] return render("/voucherprintview.mako")
def voucheraccount(self): groups = app_globals.server_proxy.groups.getAllGroups(session["gnukhata"]) group = [] #populate existing database list for db in groups: group.append(db[1]) c.groups = group c.vflag = request.params["vflag"] print c.vflag c.flag = app_globals.server_proxy.organisation.getPreferences([2],session["gnukhata"]) return render('/voucheraccount.mako')
def getProjectStatement(self): self.report_variables() print request.params c.orgname = session['orgname'] fromdate = datetime.datetime.strptime(str( session['financialfrom']),"%d-%m-%Y").strftime("%Y-%m-%d %H:%M:%S") c.from_date = session['financialfrom'] todate = datetime.datetime.strptime(str(request.params["to_date"]),"%d-%m-%Y").strftime("%Y-%m-%d %H:%M:%S") c.to_date = request.params["to_date"] c.statement = "PROJECT STATEMENT FOR : " + request.params["projects"] + "" + " FOR THE PERIOD :" + session['financialfrom'] +" to " +request.params["to_date"] projectStatementGrid = app_globals.server_proxy.reports.getProjectStatement([request.params["projects"],fromdate,fromdate,todate],session["gnukhata"]) c.trialdata = projectStatementGrid c.proj = "ps" c.length = len(projectStatementGrid) - int(1) c.totalDr = projectStatementGrid[c.length][3] c.totalCr = projectStatementGrid[c.length][4] projectStatement = odslib.ODS() projectStatement.content.getCell(1, 0).stringValue(c.orgname).setBold(True).setAlignHorizontal('center').setFontSize("13pt") #trialBalance.content.getCell(1,0).stringValue("Bold Text").setBold(True) projectStatement.content.mergeCells(1, 0, 7, 1) projectStatement.content.getCell(0, 2).stringValue(c.statement).setBold(True) projectStatement.content.mergeCells( 0, 2, 7 ,1) projectStatement.content.getColumn(0).setWidth("0.60in") projectStatement.content.getCell( 0, 4).stringValue("Sr. No.").setAlignVertical('top').setAlignHorizontal('center') projectStatement.content.getColumn(1).setWidth("1.50in") projectStatement.content.getCell( 1, 4).stringValue("Account Name").setAlignVertical('top').setAlignHorizontal('center') projectStatement.content.getColumn(2).setWidth("1.50in") projectStatement.content.getCell(2, 4).stringValue("Group Name").setAlignVertical('top').setAlignHorizontal('center') projectStatement.content.getColumn(3).setWidth("1.50in") projectStatement.content.getCell( 3, 4).stringValue("TOTAL OUTGOINGS ").setAlignVertical('top').setAlignHorizontal('center') projectStatement.content.getColumn(4).setWidth("1.50in") projectStatement.content.getCell( 4, 4).stringValue("TOTAL INCOMINGS ").setAlignVertical('top').setAlignHorizontal('center') projectStatementLength = len(projectStatementGrid) - int(1) for rowNum in range(0, projectStatementLength): projectStatement.content.getCell(0, rowNum +5).stringValue(projectStatementGrid[rowNum][0]) if len(projectStatementGrid[rowNum][1]) > 17 and len(projectStatementGrid[rowNum][1]) <= 25: projectStatement.content.getCell(1, rowNum +5).setFontSize("9pt") if len(projectStatementGrid[rowNum][1]) > 25 and len(projectStatementGrid[rowNum][1]) <= 32: projectStatement.content.getCell(1, rowNum +5).setFontSize("8pt") if len(projectStatementGrid[rowNum][1]) > 32: projectStatement.content.getCell(1, rowNum +5).setFontSize("6pt") projectStatement.content.getCell(1, rowNum +5).stringValue(projectStatementGrid[rowNum][1]).setAlignVertical('center').setAlignHorizontal('left') projectStatement.content.getRow(rowNum +5).setHeight('0.3in') #projectStatement.content.getCell(2, rowNum +5).stringValue(projectStatementGrid[rowNum][2]).setAlignVertical('top').setAlignHorizontal('center') projectStatement.content.getCell(2, rowNum +5).setFontSize("9pt").setAlignVertical('center') wrappedNaration = self.wrapString(projectStatementGrid[rowNum][2]) projectStatement.content.getCell(2, rowNum +5).stringValue(wrappedNaration).setAlignVertical('center').setAlignHorizontal('left') wrappedNaration = self.wrapString(projectStatementGrid[rowNum][2]) projectStatement.content.getCell(3, rowNum +5).stringValue(projectStatementGrid[rowNum][3]).setAlignVertical('top').setAlignHorizontal('right') projectStatement.content.getCell(4, rowNum +5).stringValue(projectStatementGrid[rowNum][4]).setAlignVertical('top').setAlignHorizontal('right') projectStatement.content.getCell(3,projectStatementLength +5).stringValue(c.totalDr).setAlignVertical('top').setAlignHorizontal('right') projectStatement.content.getCell(4,projectStatementLength +5).stringValue(c.totalCr).setAlignVertical('top').setAlignHorizontal('right') projectStatement.save("ProjectStatement.ods") return render("/GrossTrialBalance.mako")
def index(self): # Return a rendered template c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] org_details = app_globals.server_proxy.organisation.getOrganisation(session["gnukhata"]) for org in org_details: res = [org[2]] c.orgtype = org[2] session['orgtype'] = c.orgtype session.save() return render('/main.mako')
def getUnclearedAccounts(self): c.orgname = session['orgname'] c.statement1 = "ACCOUNT NAME : "+ request.params["accountname"] c.accountname1 = request.params["accountname"] fromdate = datetime.datetime.strptime(str(request.params["from_date"]),"%d-%m-%Y").strftime("%Y-%m-%d") todate = datetime.datetime.strptime(str(request.params["to_date"]),"%d-%m-%Y").strftime("%Y-%m-%d") c.fromdate = request.params["from_date"] c.todate = request.params["to_date"] financialStart = datetime.datetime.strptime(str(session["financialfrom"]),"%d-%m-%Y").strftime("%Y-%m-%d") financialEnd = session["financialto"] frm = request.params["from_date"] to = request.params["to_date"] c.statement2 = "FOR THE PERIOD : "+ frm +" to "+ to c.narrationFlag = request.params["narration_flag"] c.clearedFlag = request.params["cleared_acc_flag"] #lets call rpc updateBankRecon to get only uncleared transactions from the starting date of financial year to the end date of given period.It expects accountname, starting date of financial year, to_date respectively as input parameters. #tran_date, acc_name, ref_no, voucher_code, dbt_amount, cdt_amount, narration, clearance_date, memo (9 fields) unclear = app_globals.server_proxy.reports.updateBankRecon([request.params["accountname"],fromdate,todate,financialStart,'No Project'],session["gnukhata"]) del unclear[len(unclear)-1] del unclear[len(unclear)-1] del unclear[len(unclear)-1] del unclear[len(unclear)-1] del unclear[len(unclear)-1] del unclear[len(unclear)-1] del unclear[len(unclear)-1] for row in unclear: row.append("") #clearance date row.append("") #memo #now, get ledgerdata depending upon user requirements.(with cleared transactions or withaut cleared transactions) if request.params["cleared_acc_flag"] == 'false': c.ledgerdata = unclear c.length = len(unclear) else: # get ledger for the given period #tran_date, acc_name, ref_no, voucher_code, dbt_amount, cdt_amount, narration, clearance_date, memo (9 fields) ledger = app_globals.server_proxy.reports.getReconLedger([request.params["accountname"],fromdate,todate,financialStart,'No Project'],session["gnukhata"]) voucher_list = [] for v_code in unclear: voucher_list.append(v_code[3]) for row in ledger: if row[3] not in voucher_list : #row[3] is v_code of ledger list unclear.append(row) for row in unclear: #split clearance date into date, month, year row.append(str(row[7])[0:2]) row.append(str(row[7])[3:5]) row.append(str(row[7])[6:10]) #unclear list contains tran_date, acc_name, ref_no, voucher_code, dbt_amount, cdt_amount, narration, clearance_date, memo (9 fields), c(date), c(moth), c(year) newunclearList = sorted(unclear,key=lambda x: datetime.datetime.strptime(x[0],'%d-%m-%Y')) c.ledgerdata = newunclearList c.length = len(unclear) return render("/getUnclearedAccounts.mako")
def index(self): c.displayStatus = False #c.vendors = self.getVendor() # Return a rendered template self.result = app_globals.server_proxy.category.getCategories(session["gnukhata"]) i = 0 l = len(self.result) c.categories = [] while i < l : a = self.result[i] c.categories.append(a[1]) i = i + 1 return render('/product.mako')
def index(self): c.displayStatus = False # c.vendors = self.getVendor() # Return a rendered template self.result = app_globals.server_proxy.category.getCategories(session["gnukhata"]) i = 0 l = len(self.result) c.categories = [] while i < l: a = self.result[i] c.categories.append(a[1]) i = i + 1 return render("/product.mako")
def rollOverIndex(self): self.getEssentials() old_financialStart = datetime.date(int(session['financialto'][6:10]),int(session['financialto'][3:5]),int(session['financialto'][0:2])) print old_financialStart oneDay = datetime.timedelta(days=1) newYear = old_financialStart + oneDay c.newYear = newYear.strftime("%d-%m-%Y") old_financialEnd = datetime.date(int(session['financialto'][6:10]),int(session['financialto'][3:5]),int(session['financialto'][0:2])) print old_financialEnd oneDay = datetime.timedelta(days=365) newToYear = old_financialEnd + oneDay c.newToYear = newToYear.strftime("%d-%m-%Y") print c.newToYear return render('/rollover.mako')
def voucheraccount(self): groups = app_globals.server_proxy.groups.getAllGroups( session["gnukhata"]) group = [] #populate existing database list for db in groups: group.append(db[1]) c.groups = group c.vflag = request.params["vflag"] print c.vflag c.flag = app_globals.server_proxy.organisation.getPreferences( [2], session["gnukhata"]) return render('/voucheraccount.mako')
def editVendor(self): self.queryParams = [ request.params["vendid"], request.params["vndname"], request.params["vndadd"], request.params["cities"], request.params["postal"], request.params["states"], request.params["country"], request.params["telno"], request.params["faxno"], request.params["taxno"], request.params["creditprd"], request.params["website"], request.params["email"], request.params["contactdetails"] ] app_globals.server_proxy.vendor.editVendor(self.queryParams, session["gnukhata"]) c.flag = "n" c.vendors = self.getVendor() return render("/vendor.mako")
def customise(self): """ We will now render the same template with fieldCount updated to the number of fields requested by the client. We will also cash the categoryName and hint for saving as the queryParam for the master. The number of rows will be equal to the number of attributes requested by the client. """ #print fieldcount c.fieldCount = int(request.params['no_of_additional_fields']) fieldcount = c.fieldCount #print queryParams_master queryParams_master.append(request.params['catname']) #print queryParams_master queryParams_master.append(request.params['hint']) #print queryParams_master return render('/category.mako')
def index(self): startdate = session["financialfrom"] financial_start = datetime.datetime.strptime(str(startdate), "%d-%m-%Y").strftime("%Y-%m-%d") lastDate = app_globals.server_proxy.transaction.getLastReffDate( [financial_start, "Contra"], session["gnukhata"] ) lastReffNo = app_globals.server_proxy.transaction.getLastReference(["Contra"], session["gnukhata"]) c.lastReffDate = lastDate c.lastReference = lastReffNo c.flag == "n" c.vouchertype = "Contra" if request.params.has_key("message"): c.message = request.params["message"] self.voucher_variable() c.fromVoucherDelete = 0 return render("/voucher.mako")
def render_initialsetup(self): c.orgname = request.params["orgname"] fromdate = request.params["fromdated"] +"-"+ request.params["fromdatem"] +"-"+ request.params["fromdatey"] todate = request.params["todated"] +"-"+ request.params["todatem"] +"-"+ request.params["todatey"] c.financialYear_from = fromdate c.financialYear_to = todate c.organisationType=request.params["organisationType"] c.states = self.getStates() #app_globals.orgname = request.params["orgname"] #app_globals.financialfrom = request.params["fromdate"] #app_globals.financialto = request.params["todate"] #app_globals.financialYear = request.params["fromdate"] + " to " + request.params["todate"] #orgyear = request.params["orgname"]+request.params["fromdate"] + " to " + request.params["todate"] #app_globals.clientid_list.append(orgyear) return render('/initialsetup.mako')
def setAccount(self): print request.params if request.params["acc_code"] == "manually": self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],request.params["openingbalance"],request.params["openingbalance"],request.params["suggest_acc_code"]] else: self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],request.params["openingbalance"],request.params["openingbalance"],""] app_globals.server_proxy.account.setAccount(self.queryParams,session["gnukhata"]) self.getEssentials() c.accountname = request.params["accountname"] c.newsubgroup = request.params["newSub"] if request.params["acc_code"] == "manually": c.account_code = request.params["suggest_acc_code"] accnames = app_globals.server_proxy.account.getAllAccounts(session["gnukhata"]) c.accnames = accnames return render("/account.mako")
def setCategory(self): #c.fieldCount = int(request.params['no_of_additional_fields']) #self.queryParams_master = [request.params['queryParams_master']] self.queryParams_Details = [] rowCount = 0 c.fieldCount = int(request.params["fieldcount"]) #print fieldCount while rowCount < c.fieldCount: #print "attribute_name" + str(rowCount) self.queryParams_Details.append([request.params["attribute_name" + str(rowCount)],'text','y']) #print "attribute_name" + str(rowCount) rowCount = rowCount + 1 #print queryParams_master #print self.queryParams_Details app_globals.server_proxy.category.setCategoryMaster(queryParams_master,self.queryParams_Details,session["gnukhata"]) return render('/category.mako')
def setAccount(self): print request.params if request.params["acc_code"] == "manually": self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],request.params["openingbalance"],request.params["openingbalance"],request.params["suggest_acc_code"]] else: self.queryParams = [request.params["groupname"],request.params["subgroupname"],request.params["newSub"],request.params["accountname"],request.params["acc_code"],request.params["openingbalance"],request.params["openingbalance"],""] app_globals.server_proxy.account.setAccount(self.queryParams,session["gnukhata"]) if request.params["newSub"] != "": app_globals.server_proxy.groups.setSubGroup([request.params["groupname"],request.params["newSub"]],session["gnukhata"]) c.forward = "enable" c.accountname = request.params["accountname"] c.newsubgroup = request.params["newSub"] if request.params["acc_code"] == "manually": c.account_code = request.params["suggest_acc_code"] self.create_account() return render("/createaccount.mako")
def index(self): startdate = session['financialfrom'] financial_start = datetime.datetime.strptime( str(startdate), "%d-%m-%Y").strftime("%Y-%m-%d") lastDate = app_globals.server_proxy.transaction.getLastReffDate( [financial_start, "Contra"], session['gnukhata']) lastReffNo = app_globals.server_proxy.transaction.getLastReference( ["Contra"], session['gnukhata']) c.lastReffDate = lastDate c.lastReference = lastReffNo c.flag == "n" c.vouchertype = "Contra" if request.params.has_key("message"): c.message = request.params["message"] self.voucher_variable() c.fromVoucherDelete = 0 return render("/voucher.mako")
def login(self): self.queryParams = [request.params["organisation"],request.params["yearfrom"],request.params["yearto"]] session['orgname'] = request.params["organisation"] session['financialfrom'] = request.params["yearfrom"] session['financialto'] = request.params["yearto"] c.orgname = session['orgname'] c.financialYear_from = session['financialfrom'] c.financialYear_to = session['financialto'] #save the client's login id into the session session['gnukhata'] = app_globals.server_proxy.getConnection(self.queryParams) # app_globals.clientid = session['gnukhata'] #print session['gnukhata'] session.save() return render('/loginform.mako')
def setTax(self): #if user is entering new customer. then flag = "n". #self.queryParams = [] c.flag = request.params["flag"] #print c.flag if c.flag == "n": self.queryParams = [request.params["taxname"],request.params["taxperc"],request.params["taxnarration"]] app_globals.server_proxy.tax.setTax(self.queryParams,session["gnukhata"]) c.taxes = self.getTax() c.displayStatus = True # if user is editing customer. then flag = "e". if c.flag == "e": c.tax = self.selectTax() c.taxs = self.getTax() return render("/tax.mako")
def updateOrganisation(self): self.getEssentials() if (request.params["orgtype"] == "NGO"): reg_date = request.params["reg_date"] +"-"+ request.params["reg_month"] +"-"+ request.params["reg_year"] fcra_date = request.params["fcra_date"] +"-"+ request.params["fcra_month"] +"-"+ request.params["fcra_year"] self.queryParams_org = [request.params["orgcode"],request.params["address_lbl"],request.params["country_lbl"],request.params["state_lbl"],request.params["city_lbl"],request.params["postal_lbl"],request.params["telno_lbl"],request.params["faxno_lbl"],request.params["email_lbl"],request.params["website_lbl"],"","",request.params["reg_no_lbl"],reg_date,request.params["fcra_no_lbl"],fcra_date,request.params["pan_no_lbl"]] #print self.queryParams_org[2] result = app_globals.server_proxy.organisation.updateOrg(self.queryParams_org,session["gnukhata"]) else: self.queryParams_org = [request.params["orgcode"],request.params["address_lbl"],request.params["country_lbl"],request.params["state_lbl"],request.params["city_lbl"],request.params["postal_lbl"],request.params["telno_lbl"],request.params["faxno_lbl"],request.params["email_lbl"],request.params["website_lbl"],request.params["mvat_no_lbl"],request.params["stax_no_lbl"],"","","","",request.params["pan_no_lbl"]] result = app_globals.server_proxy.organisation.updateOrg(self.queryParams_org,session["gnukhata"]) self.msg = result c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] #print c.organisationType c.states = self.getStates() org_details = app_globals.server_proxy.organisation.getOrganisation(session["gnukhata"]) #print org_details for org in org_details: res = [org[0],org[1],org[2],org[3],org[4],org[5],org[6],org[7],org[8],org[9],org[10],org[11],org[12],org[13],org[14],org[15],org[16],org[17],org[18]] #print res c.orgcode = org[0] c.orgname = org[1] c.orgtype = org[2] c.orgaddr = org[3] c.city = org[4] c.pincode = org[5] c.state = org[6] c.country = org[7] c.telno = org[8] c.fax = org[9] c.website = org[10] c.email = org[11] c.pan = org[12] c.stax = org[13] c.mvat = org[14] c.regno = org[15] c.regdate = org[16] c.fcrano = org[17] c.fcradate = org[18] session['orgtype'] = c.orgtype return render('/organisation.mako')
def render_initialsetup(self): c.orgname = request.params["orgname"] fromdate = request.params["fromdated"] + "-" + request.params[ "fromdatem"] + "-" + request.params["fromdatey"] todate = request.params["todated"] + "-" + request.params[ "todatem"] + "-" + request.params["todatey"] c.financialYear_from = fromdate c.financialYear_to = todate c.organisationType = request.params["organisationType"] c.states = self.getStates() #app_globals.orgname = request.params["orgname"] #app_globals.financialfrom = request.params["fromdate"] #app_globals.financialto = request.params["todate"] #app_globals.financialYear = request.params["fromdate"] + " to " + request.params["todate"] #orgyear = request.params["orgname"]+request.params["fromdate"] + " to " + request.params["todate"] #app_globals.clientid_list.append(orgyear) return render('/initialsetup.mako')
def dbconnect(self): self.queryParams = [request.params['username'],request.params['password']] #print self.queryParams self.loginStatus = app_globals.server_proxy.user.getUser(self.queryParams,session['gnukhata']) #print self.loginStatus """ if app_globals.server_proxy.organisation.getOrganisationNames(session['gnukhata']) == False: states = app_globals.server_proxy.data.getStateNames() statelist = [] #populate existing state list for st in states: statelist.append(st[0]) c.states = statelist #return "session active but no organisation found" c.flag = "n" """ return render('/menubar.mako')
def rollOverIndex(self): self.getEssentials() old_financialStart = datetime.date(int(session['financialto'][6:10]), int(session['financialto'][3:5]), int(session['financialto'][0:2])) print old_financialStart oneDay = datetime.timedelta(days=1) newYear = old_financialStart + oneDay c.newYear = newYear.strftime("%d-%m-%Y") old_financialEnd = datetime.date(int(session['financialto'][6:10]), int(session['financialto'][3:5]), int(session['financialto'][0:2])) print old_financialEnd oneDay = datetime.timedelta(days=365) newToYear = old_financialEnd + oneDay c.newToYear = newToYear.strftime("%d-%m-%Y") print c.newToYear return render('/rollover.mako')
def index(self): c.flag = "n" payment = app_globals.server_proxy.account.getAllAccountNamesByLedger(session["gnukhata"]) paymentacc = [] #populate existing account list for db in payment: paymentacc.append(db[0]) c.bank = paymentacc # get current voucher code res = app_globals.server_proxy.voucher.getVoucherCode(session["gnukhata"]) if res == False: c.vouchercode = 1 else: c.vouchercode = res # get current date c.date=str(strftime("%Y-%m-%d %H:%M:%S")) c.displayStatus = False return render('/payment voucher.mako')
def setCategory(self): #c.fieldCount = int(request.params['no_of_additional_fields']) #self.queryParams_master = [request.params['queryParams_master']] self.queryParams_Details = [] rowCount = 0 c.fieldCount = int(request.params["fieldcount"]) #print fieldCount while rowCount < c.fieldCount: #print "attribute_name" + str(rowCount) self.queryParams_Details.append([ request.params["attribute_name" + str(rowCount)], 'text', 'y' ]) #print "attribute_name" + str(rowCount) rowCount = rowCount + 1 #print queryParams_master #print self.queryParams_Details app_globals.server_proxy.category.setCategoryMaster( queryParams_master, self.queryParams_Details, session["gnukhata"]) return render('/category.mako')
def login(self): self.queryParams = [ request.params["organisation"], request.params["yearfrom"], request.params["yearto"] ] session['orgname'] = request.params["organisation"] session['financialfrom'] = request.params["yearfrom"] session['financialto'] = request.params["yearto"] c.orgname = session['orgname'] c.financialYear_from = session['financialfrom'] c.financialYear_to = session['financialto'] #save the client's login id into the session session['gnukhata'] = app_globals.server_proxy.getConnection( self.queryParams) # app_globals.clientid = session['gnukhata'] #print session['gnukhata'] session.save() return render('/loginform.mako')
def dbconnect(self): self.queryParams = [ request.params['username'], request.params['password'] ] #print self.queryParams self.loginStatus = app_globals.server_proxy.user.getUser( self.queryParams, session['gnukhata']) #print self.loginStatus """ if app_globals.server_proxy.organisation.getOrganisationNames(session['gnukhata']) == False: states = app_globals.server_proxy.data.getStateNames() statelist = [] #populate existing state list for st in states: statelist.append(st[0]) c.states = statelist #return "session active but no organisation found" c.flag = "n" """ return render('/menubar.mako')
def index(self): c.flag = "n" payment = app_globals.server_proxy.account.getAllAccountNamesByLedger( session["gnukhata"]) paymentacc = [] #populate existing account list for db in payment: paymentacc.append(db[0]) c.bank = paymentacc # get current voucher code res = app_globals.server_proxy.voucher.getVoucherCode( session["gnukhata"]) if res == False: c.vouchercode = 1 else: c.vouchercode = res # get current date c.date = str(strftime("%Y-%m-%d %H:%M:%S")) c.displayStatus = False return render('/payment voucher.mako')
def getOrgDetails(self): self.getEssentials() c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] #print c.organisationType c.states = self.getStates() org_details = app_globals.server_proxy.organisation.getOrganisation( session["gnukhata"]) #print org_details for org in org_details: res = [ org[0], org[1], org[2], org[3], org[4], org[5], org[6], org[7], org[8], org[9], org[10], org[11], org[12], org[13], org[14], org[15], org[16], org[17], org[18] ] #print res c.orgcode = org[0] c.orgname = org[1] c.orgtype = org[2] c.orgaddr = org[3] c.city = org[4] c.pincode = org[5] c.state = org[6] c.country = org[7] c.telno = org[8] c.fax = org[9] c.website = org[10] c.email = org[11] c.pan = org[12] c.stax = org[13] c.mvat = org[14] c.regno = org[15] c.regdate = org[16] c.fcrano = org[17] c.fcradate = org[18] #print c.orgaddr session['orgtype'] = c.orgtype #print app_globals.orgtype return render('/organisation.mako')
def setProject(self): c.orgtype = session['orgtype'] c.userrole = session['userrole'] self.create_account() c.orgname = session['orgname'] c.financialfrom = session['financialfrom'] c.financialto = session['financialto'] length = request.params["hidden_length"] print length print request.params["hidden_has_project"] if request.params["hidden_has_project"] == "hasproject": for i in range(1, int(length)): queryParams = [ request.params["projname" + str(i)], request.params["projamount" + str(i)] ] app_globals.server_proxy.organisation.setProjects( queryParams, session["gnukhata"]) c.message = "Project added successfully" c.flag = "e" return render('/addproject.mako')
def index(self): """ c.flag = "n" contra = app_globals.server_proxy.contravoucher.getContraAccounts(session["gnukhata"]) contracc = [] #populate existing account list for db in contra: contracc.append(db[0]) c.bank = contracc # get current voucher code res = app_globals.server_proxy.voucher.getVoucherCode(session["gnukhata"]) if res == False: c.vouchercode = 1 else: c.vouchercode = res # get current date c.date=str(strftime("%Y-%m-%d %H:%M:%S")) c.displayStatus = False """ self.vouchertype = request.params["vouchertype"] #print self.vouchertype return render('/contra voucher.mako')
def index(self): # Return a rendered template #right now we are just displaying the template and do not know the field count. #fieldcount = 0 c.fieldCount = 0 return render('/category.mako')